Spatial Mask for Permutation Clustering Test


I’m currently trying to run the spatio_temporal_cluster_test on an a priori region of the brain; however I’m not quite sure how to get the list of spatial indices for the spatial_exclude parameter. I’m working in volumetric source space and all the help I’ve been able to find has focused on surface source space and used .label files to find the indices which doesn’t appear to work for volumetric source space.

Any advice on how to take a nifti of a mask and get the spatial indices to exclude from that would be appreciated.


Hi @cpirrung,
mne has support for checking if volumetric points are contained in specified atlas labels. An example of this can be found in this tutorial (search for “volumetric” on this page to find the relevant part) and some overview in this pull request.
We were doing a bit permutation cluster testing in volumetric source space with @nruban and, if I remember correctly, picking the correct indices by hand was not straightforward because the order of src volumetric data in mne is Fortran-way, not the default C-way, which we found out only later with trial and error. Nastia do you have a piece of code to share to help @cpirrung with selecting volume indices for cluster-based test?