Skip to contents

Constructor function for NeuroSpace class

Usage

NeuroSpace(dim, spacing = NULL, origin = NULL, axes = NULL, trans = NULL)

Arguments

dim

An integer vector describing the dimensions of the image grid.

spacing

A numeric vector representing the real-valued voxel dimensions (e.g., in millimeters). If not provided, the default is set to a vector of ones with the same length as the dimensions.

origin

A numeric vector representing the coordinate origin of the image space. If not provided, the default is set to a vector of zeroes with the same length as the dimensions.

axes

An AxisSet object representing the image axes ordering. If not provided, the default axes are determined based on the NIFTI standard (Left-Posterior-Inferior).

trans

A matrix representing the coordinate transformation associated with the image space. If not provided, the default is based on the NIFTI standard ("Neurological" orientation).

Value

An instance of the NeuroSpace class.

Note

Users rarely need to create a new NeuroSpace instance, as it will almost always be created automatically using information stored in an image header. If an existing image object is available, its NeuroSpace instance can be easily extracted with the space method.

Examples

bspace <- NeuroSpace(c(64, 64, 64), origin = c(0, 0, 0), spacing = c(2, 2, 2))
bspace
#> NeuroSpace
#>   Type           : NeuroSpace 
#>   Dimension      : 64 64 64 
#>   Spacing        : 2  X  2  X  2 
#>   Origin         : 0  X  0  X  0 
#>   Coordinate Transform : 2 0 0 0 0 2 0 0 0 0 2 0 0 0 0 1 
origin(bspace)
#> [1] 0 0 0
axes(bspace)
#> instance of class: AxisSet3D 
#> 
#> Axis 1: Left-to-Right 
#> Axis 2: Posterior-to-Anterior 
#> Axis 3: Inferior-to-Superior 
trans(bspace)
#>      [,1] [,2] [,3] [,4]
#> [1,]    2    0    0    0
#> [2,]    0    2    0    0
#> [3,]    0    0    2    0
#> [4,]    0    0    0    1