Hi,
I was trying to plot a specific ROI region, e.g., "Precentral_L" defined in the AAL mask, The data is a 3D image from fetch_atlas_aal . And I couldn't find out how to build a mask with ROI name or index. Can someone please help? Thanks very much.
Hi @xuesongwang,
This type of question better goes to the Neurostars interface. But you can see that the corresponding index is '2001', so you simply need to pick the voxels that have this value. You can use the math_img function for that.
import nilearn.datasets as nd
aal = nd.fetch_atlas_aal()
aal['indices'][aal['labels'] == 'precentral_L']
Best
Hi @xuesongwang
Were you able to build the mask? As @bthirion said, you can use math_img("img==2001", img=aal['maps']).
Unless there is still something unclear, I propose to close this.
Thanks!
@bthirion @NicolasGensollen Yes, it perfectly solves my problem. Thanks a lot. I didn't know about the data structure in nii image format before (width, height, depth, ...) and that index numbers represent the ROI index , that's why I couldn't modify the input voxels.