accessor-methods: Extract Image Attributes 'pixeltype' from antsImages

pixeltypeR Documentation

Extract Image Attributes pixeltype from antsImages

Description

Methods that act on the slots of the antsImage object

Usage

pixeltype(object)

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

pixeltype(object) <- value

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

components(object)

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

components(object) <- value

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

spacing(object)

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

spacing(object) <- value

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

direction(object)

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

direction(object) <- value

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

origin(object)

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

origin(object) <- value

## S4 replacement method for signature '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)

stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.