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

Description Usage Arguments Examples

Description

Methods that act on the slots of the antsImage object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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)

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