Basic questions about masks for searchlight in nilearn


I have some basic questions about the argument of the nilearn.decoding.SearchLight.
According to the example, mask_img is the original mask, and process_mask_img is a subset of mask_img that contains the voxels that should be processed.

I want to do searchlight only in the motor cortex,
so I used the individual space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz mask from fmriprep for mask_img. Is this a proper way?
and for process_mask_img, I create a binary mask (motor_mask) from the precentral gyrus in aal, and resample it to mask_img for the same shape and affine.

The SearchLight() doesn’t work with appying both mask_img and process_mask_img defined above with the error; “These Spheres are empty: [list of spheres]”, but it works when I use only one of them as the argument of mask_img, so I got the results of either whole-brain or motor-cortex searchlight.

The definition of in the example makes me doubt if the motor-cortex searchlight results are proper based on SearchLight(mask_img = motor_mask, process_mask_img = None).

my hunch is that some voxels that are included in your motor cortex mask are excluded from the mask that was created from fmriprep

1 Like

Hello Rémi,

Thank you very much for your reply.
I see what you mean now, and yes, it seems possible.
Does it make sense for you if I only use the motor_mask as SearchLight(mask_img = motor_mask, process_mask_img = None) to do searchlight in the motor cortex?

that would not shock me if you did it! :wink:

otherwise compute the intersection of the two masks:

1 Like