Subsets an antsImage or nifti object from 4D

subset_4d(img, ind, ...)

# S4 method for character
subset_4d(img, ind, ...)

# S4 method for nifti
subset_4d(img, ind, ...)

# S4 method for antsImage
subset_4d(img, ind, ...)

.subset_4d(img, ind)

Arguments

img

character path of image or an object of class nifti, or antsImage

ind

subset indexers for the 4th dimension (usually time)

...

Arguments passed to copyNIfTIHeader or antsCopyImageInfo

Value

An antsImage or nifti depending on input

Author

John Muschelli muschellij2@gmail.com

Examples

library(oro.nifti) n = 20 x = nifti(array(rnorm(n^3*10), dim = c(n, n, n, 10))) ind = 2:3 subset_4d(x, ind)
#> NIfTI-1 format #> Type : nifti #> Data Type : 2 (UINT8) #> Bits per Pixel : 8 #> Slice Code : 0 (Unknown) #> Intent Code : 0 (None) #> Qform Code : 0 (Unknown) #> Sform Code : 0 (Unknown) #> Dimension : 20 x 20 x 20 x 2 #> Pixel Dimension : 1 x 1 x 1 x 1 #> Voxel Units : Unknown #> Time Units : Unknown
subset_4d(x, ind = 1)
#> NIfTI-1 format #> Type : nifti #> Data Type : 2 (UINT8) #> Bits per Pixel : 8 #> Slice Code : 0 (Unknown) #> Intent Code : 0 (None) #> Qform Code : 0 (Unknown) #> Sform Code : 0 (Unknown) #> Dimension : 20 x 20 x 20 #> Pixel Dimension : 1 x 1 x 1 #> Voxel Units : Unknown #> Time Units : Unknown