NeuroSpace | R Documentation |
This function constructs a NeuroSpace object, which defines the spatial properties of a neuroimaging volume, including its dimensions, origin, spacing, axes, and coordinate transformation.
NeuroSpace(dim, spacing = NULL, origin = NULL, axes = NULL, trans = NULL)
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, defaults to a vector of ones with the same length as 'dim'. |
origin |
A numeric vector representing the coordinate origin of the image space. If not provided, defaults to a vector of zeros with the same length as 'dim'. |
axes |
An |
trans |
A matrix representing the coordinate transformation associated with the image space. If not provided, a default transformation is constructed based on the spacing and origin. |
The function performs several checks and computations:
It ensures that 'spacing' and 'origin' have appropriate lengths and values.
If 'trans' is not provided, it constructs a default transformation matrix.
It determines the appropriate axis set if not provided.
It creates a NeuroSpace object with the specified or computed properties.
The resulting NeuroSpace object encapsulates all the spatial information necessary to interpret and manipulate neuroimaging data.
An instance of the NeuroSpace
class.
Users rarely need to create a new NeuroSpace
instance directly, 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.
AxisSet-class
for details on axis specifications.
NeuroVol-class
for volumetric data using NeuroSpace.
space
for extracting NeuroSpace from existing objects.
# Create a 3D NeuroSpace object
bspace_3d <- NeuroSpace(c(64, 64, 64), origin = c(0, 0, 0), spacing = c(2, 2, 2))
print(bspace_3d)
cat("Origin:", origin(bspace_3d), "\n")
cat("Axes:", axes(bspace_3d), "\n")
cat("Transformation matrix:\n")
print(trans(bspace_3d))
# Create a 2D NeuroSpace object
bspace_2d <- NeuroSpace(c(128, 128), spacing = c(1.5, 1.5))
print(bspace_2d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.