pixeltype
from antsImagesaccessor-methods.Rd
Methods that act on the slots
of the
antsImage object
pixeltype(object) # S4 method for antsImage pixeltype(object) pixeltype(object) <- value # S4 method for antsImage pixeltype(object) <- value components(object) # S4 method for antsImage components(object) components(object) <- value # S4 method for antsImage components(object) <- value spacing(object) # S4 method for antsImage spacing(object) spacing(object) <- value # S4 method for antsImage spacing(object) <- value direction(object) # S4 method for antsImage direction(object) direction(object) <- value # S4 method for antsImage direction(object) <- value origin(object) # S4 method for antsImage origin(object) origin(object) <- value # S4 method for antsImage origin(object) <- value
object | is an object of class |
---|---|
value | is the value to assign to the slot. |
img01 <- as.antsImage(array(1:64, c(4,4,4,1))) stopifnot(is.character(pixeltype(img01))) pixeltype(img01) = "float" testthat::expect_error({ pixeltype(img01) = 1.5 }) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) stopifnot(components(img01) == 1) components(img01) = 1L testthat::expect_error({ components(img01) = 1.5 }) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) stopifnot(all(spacing(img01) == rep(1, 4))) spacing(img01) = rep(1, 4) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) stopifnot(is.matrix(direction(img01))) direction(img01) = diag(4) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) stopifnot(all(origin(img01) == rep(0, 4))) origin(img01) = rep(0, 4)