Map voxels to parcels

I want to “label” each voxel to a specific parcel based on an atlas.

My question is, is there an exposed API that returns the parcel label of each voxel? In other words, which parcel a voxel belong to. I assume this is already implemented using fit_transform and plot_roi methods. The fit_transform method averages the time-series of the voxels that belong to the same parcel. I am trying to track down plot_roi to see how you map the voxels to parcels based on the center of mass coordinates but before going further I just want to make sure that there is an API exposed to do this?

If it matters, I use Yeo17thick atlas.

Code Example:
Assume I have a time-series matrix A_{t x v}, where t is the time and v is the number of voxels:

I = get_parcels_labels(A, yeo['thick17']) #yeo['thick17'] is the file path of nifti of yeo

The output, I , will be a vector of size v , where each element could have a value {0,1,2,…,16}. Which represents the parcels’ labels.

Hello, for a “deterministic” atlas such as Yeo, the information your searching for is directly contained in the atlas which is a 3D image where each voxel value is its parcel value.

If you want it as a vector, corresponding to your voxels of interest, you should mask it using NiftiMasker()

For “probabilistic” atlases, you have a 4D image where 1st 3D image contains the probability for every voxel to be in 1st parcel and so on.