NeuroSpace-class | R Documentation |
The NeuroSpace class represents the geometric properties of a brain image, including its dimensions, origin, spacing, axes, and coordinate transformations. It provides a comprehensive framework for handling spatial information in neuroimaging data analysis.
dim
An integer vector representing the grid dimensions of the image.
origin
A numeric vector representing the coordinates of the spatial origin.
spacing
A numeric vector representing the dimensions (in mm) of the grid units (voxels).
axes
A named AxisSet
object representing the set of spatial axes in the untransformed native grid space.
trans
A matrix representing an affine transformation that converts grid coordinates to real-world coordinates.
inverse
A matrix representing an inverse transformation that converts real-world coordinates to grid coordinates.
A NeuroSpace
object is considered valid if:
The length of the dim
slot is equal to the lengths of the spacing
, origin
, and number of axes in the axes
slots.
The dim
slot contains only non-negative values.
The following methods are available for NeuroSpace
objects:
dim
: Get the dimensions of the space.
origin
: Get or set the origin of the space.
spacing
: Get or set the spacing of the space.
axes
: Get the axes of the space.
transform
: Apply the affine transformation to coordinates.
inverse_transform
: Apply the inverse transformation to coordinates.
The NeuroSpace
class is fundamental in representing and manipulating
the spatial properties of neuroimaging data. It is used extensively throughout
the package for operations that require spatial information, such as image
registration, resampling, and coordinate transformations.
For more information on spatial transformations in neuroimaging: Brett, M., Johnsrude, I. S., & Owen, A. M. (2002). The problem of functional localization in the human brain. Nature Reviews Neuroscience, 3(3), 243-249.
AxisSet-class
for details on the axis set representation.
NeuroVol-class
and NeuroVec-class
for classes that use NeuroSpace.
# Create a NeuroSpace object
space <- NeuroSpace(dim = c(64L, 64L, 64L),
origin = c(0, 0, 0),
spacing = c(1, 1, 1))
# Get the dimensions
dim(space)
# Set a new origin
origin(space) <- c(-32, -32, -32)
# Apply a transformation to a set of coordinates
coords <- matrix(c(10, 20, 30), ncol = 3)
transformed_coords <- transform(space, coords)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.