| read_vol | R Documentation |
Reads exactly one 3D volume from a neuroimaging file and returns it as a
DenseNeuroVol. Accepts both 3D files (where only
index = 1 is valid) and 4D files (where index selects a single
sub-volume along the 4th dimension).
read_vol(file_name, index = 1)
file_name |
Path to a single image file (NIfTI |
index |
Integer giving the index of the sub-volume to load. Must be |
A DenseNeuroVol (always 3D, always dense). The
associated NeuroSpace has three spatial dimensions even
when the source file is 4D.
read_vec for loading 4D data as a NeuroVec,
read_image for automatic dimensionality-based dispatch, and
read_hyper_vec for 5D data.
# Read the first volume from a 4D file
fname <- system.file("extdata", "global_mask_v4.nii", package="neuroim2")
x <- read_vol(fname)
print(dim(x)) # 3D
space(x)
# Read the 3rd sub-volume from the same 4D file
x3 <- read_vol(fname, index = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.