Convenience wrapper that inspects the file metadata and dispatches to
read_vol for 3D data, read_vec for 4D data,
or read_hyper_vec for 5D data.
Arguments
- file_name
Character vector of file paths.
- type
One of
"auto","vol","vec", or"hyper"to override dispatch.- index
Volume index to use when returning a
NeuroVolor when you want to load a subset of volumes while still returning aNeuroVec.- indices
Optional vector of indices passed through to
read_vec.- mask
Optional spatial mask passed through to vector/hyper-vector readers.
- mode
IO mode forwarded to
read_vec.
Value
A NeuroVol when the input is effectively 3D (or when
type = "vol"), a NeuroVec/NeuroVecSeq
for 4D input, or a NeuroHyperVec for 5D input.
Examples
vol <- read_image(system.file("extdata", "global_mask2.nii.gz", package = "neuroim2"))
vec <- read_image(system.file("extdata", "global_mask_v4.nii", package = "neuroim2"))