Methods that act on the slots of the antsImage object

pixeltype(object)

# S4 method for class 'antsImage'
pixeltype(object)

pixeltype(object) <- value

# S4 method for class 'antsImage'
pixeltype(object) <- value

components(object)

# S4 method for class 'antsImage'
components(object)

components(object) <- value

# S4 method for class 'antsImage'
components(object) <- value

spacing(object)

# S4 method for class 'antsImage'
spacing(object)

spacing(object) <- value

# S4 method for class 'antsImage'
spacing(object) <- value

direction(object)

# S4 method for class 'antsImage'
direction(object)

direction(object) <- value

# S4 method for class 'antsImage'
direction(object) <- value

origin(object)

# S4 method for class 'antsImage'
origin(object)

origin(object) <- value

# S4 method for class 'antsImage'
origin(object) <- value

Arguments

object

is an object of class antsImage.

value

is the value to assign to the slot.

Examples

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)