Voxel-level signal in atlas regions

Hi,

I’m trying to extract signal at the voxel-level from regions using different atlases. I was looking at the NiftiLabelMasker function, but it seems to only return aggregated signal for each region. Is there a way to not aggregate the signal with NiftiLabelMasker or use regions in an atlas separately as a mask with NiftiMasker ?

I’m working with 3D images (beta maps).

Thanks !

Hi @m_p

This older post might be relevant:

Can you confirm if that’s what you were looking for ?

HTH,

Elizabeth

Thanks ! It’s exactly what I want to do. I’m just not sure how to decompose an atlas into regions. I’ve look at nilearn documentation and find the RegionExtractor function. I tried this function and used the regions_img_ attributes (4D image) as the input of the NiftiMasker but I’ve got an error for incompatible dimensionality (Expected dimension is 3D and you provided a 4D image).

if your atlas takes value in a given label set

from nilearn.image import math_img
for i in labels:
binary_mask_i = math_img(‘i1 == %d’ % i, i1=atlas)

then you can use binary_mask_i in a NiftiMasker instance to get values for region i

Thank you so much for your help!