antsImageGetSet: antsImageGetSet

Description Usage Arguments Value Examples

Description

Get and set methods for image header information

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

x

antsImage to access, of dimensionality d.

spacing

numeric vector of length d.

origin

numeric vector of length d.

direction

matrix of size d * d.

Value

For get methods, vector of length d (origin, spacing) or matrix of size d * d (direction). For set methods, 0 to indicate success.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
img <- makeImage(c(5,5), rnorm(25))
antsGetSpacing(img)
antsSetSpacing(img, c(2.0, 2.0))
antsGetOrigin(img)
antsSetOrigin(img, c(0.5, 0.5))
testthat::expect_error(antsGetSpacing(as.array(img) ) )
testthat::expect_error(antsSetSpacing(as.array(img), c(2,2) ), "class" )
testthat::expect_error(antsSetSpacing(img, c("2",2) ), "numeric" )
testthat::expect_error(antsSetSpacing(img, c(3,3,3) ), "dimensions" )

testthat::expect_error(antsGetOrigin(as.array(img) ) )
testthat::expect_error(antsSetOrigin(as.array(img), c(0.5, 0.5) ) )
testthat::expect_error(antsSetOrigin(img, c("0.5", 0.5) ) )
testthat::expect_error(antsSetOrigin(img, c(0.5, 0.5, 0.5) ) )
img <- makeImage(c(5,5), rnorm(25))
antsGetDirection(img)
testthat::expect_error(antsGetDirection(as.array(img) ) )
outimg <- makeImage(c(5,5), rnorm(25))
antsGetDirection(outimg)
direct = antsGetDirection(outimg)
antsSetDirection(outimg, direct)
testthat::expect_error(antsSetDirection(as.array(outimg), direct) ) 
testthat::expect_error(antsSetDirection(outimg, as.numeric(direct)) ) 
testthat::expect_error(antsSetDirection(outimg, diag(length(dim(outimg))+1) ))

muschellij2/atropos documentation built on Oct. 11, 2018, 12:24 a.m.