Get Talairach labels from mask


I have manually created masks for acute stroke lesions for a relatively large cohort. To analyze the effect of the different stroke locations, we would like to get the Talairach lobe-labels for the stroke masks. I have looked into NifiLabelsMasker and NiftiMasker, but can’t see that this kind of functionality is implemented.
Could this be done in nilearn or do we have to use any other tools?

Thanks in advance!

Hi, you could mask the atlas map with your stroke mask and take the most frequent label in the result? something like

import numpy as np
from nilearn.input_data import NiftiMasker
from nilearn.image import new_img_like, get_data, resample_to_img
from nilearn.datasets import fetch_atlas_talairach, fetch_atlas_destrieux_2009

destrieux = fetch_atlas_destrieux_2009()
# this is just to build an example mask, use the stroke mask instead
left_precentral_gyrus = new_img_like(destrieux.maps,
                                     get_data(destrieux.maps) == 29)
talairach = fetch_atlas_talairach("hemisphere")
atlas_maps = resample_to_img(talairach.maps,
masked = np.rint(
vals, counts = np.unique(masked, return_counts=True)
# prints "Left Cerebrum"
1 Like

Thank you for your reply!
I’ve just discovered atlasreader which does everything I was looking for!
Just applied the stroke lesion mask to an image and fed the result into atlasreader! After some tweaking everything worked fine :wink: