fillVectorImage: this a first test whether it is possible to call SimpleITK...

Description Usage Arguments Value Examples

View source: R/fillVectorImage.r

Description

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.

Usage

1
fillVectorImage(image, indices, values, float = FALSE)

Arguments

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)

Value

returns the updated image

Examples

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,]))

zarquon42b/RcppSimpleITK documentation built on May 4, 2019, 9:09 p.m.