This S4 class represents a four-dimensional brain image, which can be used to store and process time series data such as fMRI or 4D functional connectivity maps. The class extends the basic functionality of NeuroObj
.
Constructor function for the NeuroVec
class. This function is used to create an instance of a NeuroVec object, which represents a four-dimensional brain image.
Arguments
- data
The image data, which can be a matrix, a 4D array, or a list of
NeuroVol
objects. If the latter, the geometric space of the data (NeuroSpace
) will be inferred from the constituent volumes, which must all be identical.- space
An optional
NeuroSpace
object. Does not need to be included if thedata
argument is a list ofNeuroVol
objects.- mask
An optional
array
of typelogical
.- label
A label of type
character
.
Value
A concrete instance of the NeuroVec
class. If a mask
is provided, the function returns a SparseNeuroVec
object; otherwise, it returns a DenseNeuroVec
object.
Examples
# Load an example 4D brain image
example_4d_image <- read_vec(system.file("extdata", "global_mask_v4.nii", package="neuroim2"))
# Create a NeuroVec object by copying the @.Data field (not advised in practice)
neuro_vec <- NeuroVec(data=example_4d_image@.Data, space=space(example_4d_image))
# Load an example 4D brain image
example_4d_image <- read_vec(system.file("extdata", "global_mask_v4.nii", package="neuroim2"))
# Create a NeuroVec object
neuro_vec <- NeuroVec(data=example_4d_image@.Data, space=space(example_4d_image))