I’m trying to find a python-way of achieving what the “canlab” toolbox does in the ttest->threshold->region->table workflow.
I know that nilearn is good with regions vis-a-vis the NiftiLabelsMasker, but I couldn’t figure out how to complement that region summary with stats (see attached image)
I’m not sure what stats you need exactly.
My impression is that you need voxel-level values. For this you probably want to use NiftiMasker to extract whichever values from any given ROI.
The stats I’m interested in are basically what nilearn.reporting.get_clusters_table provides … what I would like in addition - so as to mimic the table function of CANLAB us to identify the Regions Label name of each identified cluster (using a parcellation of my choosing?).
In addition it would be cool if there was someting similar to the montage function that create a slice level plot to highlight the identified cluster so as to best illustrate them visually.
The best way to achieve that is to call get_clusters_table, yet providing the mask of the ROI (for which you want to provide the name). Note that some the atlases available in nilearn come with labels.
Let me know if you need more guidance on a particular aspect.
Regarding montage(), you probably want to have custom code doing it (all low-level functions you want to call are in Nilearn). If you think it would be worth sharing in nilearn, you might want to open an issue for discussion there.
So basically call get_clusters_table for each cluster? Could employ a “look up table” approach where iterate through the results of get_clusters_table and identify the label based on X-Y-Z coordinates?
It’s certainly doable “manually”, eg testing that a given coordinate is close enough to a predefined region.
It is a bit annoying to identify clusters by coordinates, since the selection of clusters relies on a masking (numpy fancy indexing).
I don’t think that there would be a heavy overhead in using iterated calls varying the mask.
not sure if related/helpful or not but maybe atlasreader could be interesting here!?
HTH, cheers, Peer
amazing! just what I was looking for really!