nigsp.operations.nifti.unfold_atlas¶
- nigsp.operations.nifti.unfold_atlas(data, atlas, mask=None)[source]¶
Return a lower dimensional matrix into a 3- or 4- D matrix based on an atlas.
(i.e. unfold a matrix into a 3D atlas)
- Parameters:
- data
numpy.ndarray
A 1- or 2- D matrix of shape parcels*timepoints.
- atlas
numpy.ndarray
A 3D matrix that represents an atlas.
- mask
None
ornumpy.ndarray
, optional A matrix with the same shape as atlas. All non-zero elements will be considered for the unfolding, all zero elements will be excluded.
- data
- Returns:
numpy.ndarray
A 3- or 4- D matrix of shape [atlas]*[timepoints]. Contains the timeseries unfolded in the atlas.
- Raises:
ValueError
If atlas and mask have dimensions that are too different (i.e. more than 1 dimension of difference) If mask has different shapes from atlas. If the first dimension of the data is not equal to the amount of label in the atlas.