Description Usage Arguments Value Examples
View source: R/fillVectorImage.r
this a first test whether it is possible to call SimpleITK via Rcpp. It simply shows how to change the origin of a sitk::Image using SimpleITK's C++ interface.
1 | fillVectorImage(image, indices, values, float = FALSE)
|
image |
SimpleITK image |
indices |
integer matrix with rows containing (1-based) indices |
values |
numeric matrix with rows containing vectors |
float |
if TRUE, vectors will be coerced to float (instead of double) |
returns the updated image
1 2 3 4 5 6 7 | require(SimpleITK)
img <- Image(10,10,10,"sitkVectorFloat32")
indices <- as.matrix(expand.grid(1:10,1:10,1:10))
set.seed(42)
values <- matrix(rnorm(3000),1000,3)
img <- fillVectorImage(img,indices,values)
stopifnot(all.equal(img[1,1,1],values[1,]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.