scrub and CompCorfMRI data for scrub and CompCor
Wide numeric data matrix (\(T observations\) by \(V variables\), \(T << V\)).
For example, if X represents an fMRI run, \(T\) should be the number
of timepoints and \(V\) should be the number of brainordinate vertices/voxels.
Or, a 4D array or NIFTI or file path to a NIFTI (\(I\) by \(J\) by \(K\) by \(T\)
observations), in which case ROI_data must be provided.
(The vectorized data will be \(T timepoints\) by \(V_{in-mask} voxels\))
Or, a ciftiTools "xifti" object or a file path to a CIFTI
(The vectorized data will be \(T timepoints\) by \(V_{left+right+sub} grayordinates\)).
Indicates the data ROI. Allowed arguments depend on X:
If X is a matrix, this must be a length \(V\) logical vector, where
the data ROI is indicated by TRUE values. If "infer" (default), all
columns of X will be included in the data ROI (rep(TRUE, V)).
If X is an array or NIFTI, this must be either a vector of values
to expect for out-of-mask voxels in X, or a (file path to a) 3D NIFTI.
In the latter case, each of the volume dimensions should match the first
three dimensions of X. Voxels in the data ROI should be indicated by
TRUE and all other voxels by FALSE. If "infer" (default),
will be set to c(0, NA, NaN) (include all voxels which are not constant
0, NA, or NaN).
If X is a "xifti" this must be the brainstructures
argument to ciftiTools::read_cifti. If "infer" (default),
brainstructures will be set to "all" (use both left and right
cortex vertices, and subcortical voxels).
If NULL, the data ROI will be empty. This is useful for obtaining just
the noise ROI, if the data and noise are located in separate files.
Indicates the noise ROIs for aCompCor. Should be a list where
each entry corresponds to a distinct noise ROI. The names of the list should
be the ROI names, e.g. "white_matter" and "csf". The expected
formats of the list entries depends on X:
For all types of X, ROI_noise entries can be a matrix of noise
ROI data. The matrix should have \(T\) rows, with each column being a
data location's timeseries.
If X is a matrix, entries can also indicate a noise ROI within X.
These entries must be a length \(V\) logical vector with TRUE values
indicating locations in X within that noise ROI. Since the ROIs must
not overlap, the masks must be mutually exclusive with each other, and with
ROI_data.
If X is an array or NIFTI, entries can also indicate a noise ROI within X.
These entries must be a logical array or (file path to) a 3D NIFTI with the
same spatial dimensions as X, and with TRUE values indicating
voxels inside the noise ROI. Since the ROIs must not overlap, the masks must
be mutually exclusive with each other, and with ROI_data.
(If X is a "xifti", entries must be data matrices, since no
grayordinate locations in X are appropriate noise ROIs).