[Neuroimaging] Use of atlas to compute Z-Scores

Christophe Pallier christophe at pallier.org
Wed Feb 14 13:09:27 EST 2018


Sorry if my messages were too sketchy.

I just gave it a try, using the "AAL2.nii" file provided in the spm aal2
toolbox.



In [1]: from nilearn.input_data import NiftiLabelsMasker
In [2]: a = NiftiLabelsMasker('AAL2.nii')
In [3]: import glob
In [4]: imgs = glob.glob('*.hdr')  # there are 5 analyze image files (3d)
in my current directory
In [5]: b = a.fit_transform(imgs)
In [6]: b.shape
Out[6]: (5, 120)

So, the ouput is a matrix with 5 lines (the images) and 120 columns (the
numbers of parcels, or rois, in the aal2 mask file; see
https://github.com/spunt/bspmview/blob/master/supportfiles/AAL2_README.txt)

I understood that this is what you were looking for to compute the averages
and stdev of activities in each ROIs in the control group.



On Wed, Feb 14, 2018 at 6:38 PM, Gael Varoquaux <
gael.varoquaux at normalesup.org> wrote:

> Dear Gabriel,
>
> What is wrong with the code that Christophe gave in his email? It seems
> to me that it should work for your purpose.
>
> Indeed, the examples online are more set in the context of multivariate
> analysis, so I can understand why they are not obvious to link to your
> usecase.
>
> Best,
>
> Gaël
>
> On Wed, Feb 14, 2018 at 06:17:15PM +0100, Gabriel Reynés wrote:
> > Thanks,
>
> > I lost hours trying to fit the function NiftiLabelsMasker the the AAL
> atlas. I
> > do not know if I am performing an stupid mistake, but this function does
> not
> > seems to suit the task of labeling en atlas. The examples provided seems
> quite
> > oscure and dealing with another topic.
>
> > Is there another way around to perfrom the task of segmenting a brain
> based on
> > an atlas?
>
> > Thanks in advance!
>
>
> > Gabriel
>
> > On Wed, Feb 14, 2018 at 11:25 AM, Gabriel Reynés <greynell at gmail.com>
> wrote:
>
> >     Dear Christophe  ,
>
>
> >     Thanks for your answer! I spent many hours triyng to figure the
> behaviour
> >     of NiftiLabelsMasker
> >     I do not understand how to iterate over each mask ROI.
>
> >     How one can iterate over each label of a masker?
>
> >     `# Obtain AAL Atlas
> >     aal = datasets.fetch_atlas_aal('SPM12')
> >     aal_labels = aal.labels
>
> >     # Obtain mask
> >     masker = input_data.NiftiLabelsMasker(aal.maps)
>
> >     # Input image to compute the mean value for each
> >     patient_img = image.load_img(path_nii)
> >     patient_img  = patient_img.get_data()
>
> >     # Fit the mask to the image
> >     masker_fit(patient_img)
> >     mask_img = masker_fit.mask_img_
>
> >     Thanks in advance,
>
>
> >     Gabriel
>
>
>
>
>
>
> > _______________________________________________
> > Neuroimaging mailing list
> > Neuroimaging at python.org
> > https://mail.python.org/mailman/listinfo/neuroimaging
>
>
> --
>     Gael Varoquaux
>     Senior Researcher, INRIA Parietal
>     NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France
>     Phone:  ++ 33-1-69-08-79-68
>     http://gael-varoquaux.info            http://twitter.com/GaelVaroquaux
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
>



-- 
--
Christophe Pallier <christophe at pallier.org>
INSERM-CEA Cognitive Neuroimaging Lab, Neurospin, bat 145,
91191 Gif-sur-Yvette Cedex, France
Tel: 00 33 1 69 08 79 34
Personal web site: http://www.pallier.org
Lab web site: http://www.unicog.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20180214/1d0b89aa/attachment.html>


More information about the Neuroimaging mailing list