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:
datanumpy.ndarray

A 1- or 2- D matrix of shape parcels*timepoints.

atlasnumpy.ndarray

A 3D matrix that represents an atlas.

maskNone or numpy.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.

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.