<div dir="ltr"><div>Ah! if you put the single filename in a list as argument to fit_transform, it should work I think (please confirm).<br></div>The error message is indeed a bit confusing.<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 15, 2018 at 9:06 AM, Gabriel Reynés <span dir="ltr"><<a href="mailto:greynell@gmail.com" target="_blank">greynell@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear all,<div><br></div><div>thank you for all responses. My main problem was that the function masker.fit_transform(<wbr>) needs a 4D image to work. I was trying to perform the computation first with the single patient and this error was raised:</div><div><br></div><div>"DimensionError: Input data has incompatible dimensionality: Expected dimension is 4D and you provided a 3D image. See <a href="http://nilearn.github.io/manipulating_images/input_output.html" target="_blank">http://nilearn.github.io/manip<wbr>ulating_images/input_output.<wbr>html</a>.</div><div>"</div><div><br></div><div>To solve that, based in your example, I saw that I need to perform the fit_transform over the single subject and the normal database at the same time, this is more cpu-consuming and prone to errors, but know seems to work just fine.</div><div><br></div><div>Thanks!</div><div><br></div><div><br></div><div>Best regards,</div><div><br></div><div><br></div><div>Gabriel</div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Feb 14, 2018 at 11:25 AM, Gabriel Reynés <span dir="ltr"><<a href="mailto:greynell@gmail.com" target="_blank">greynell@gmail.com</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Christophe<span> </span></span>
,<div><br></div><div><br></div><div>Thanks for your answer! I spent many hours triyng to figure the behaviour of NiftiLabelsMasker</div><div>I do not understand how to iterate over each mask ROI.</div><div><br></div><div>How one can iterate over each label of a masker?</div><div><br></div><div>`# Obtain AAL Atlas</div><div><div>aal = datasets.fetch_atlas_aal('SPM1<wbr>2')</div><div>aal_labels = aal.labels</div><div><br></div><div># Obtain mask</div><div>masker = input_data.NiftiLabelsMasker(a<wbr>al.maps)<br></div><div><br></div><div># Input image to compute the mean value for each</div><div>patient_img = image.load_img(path_nii)<br></div><div>
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">patient_img<span> </span></span>
=
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">patient_img</span>.get_data()<br></div><div><br></div><div># Fit the mask to the image</div><div>masker_fit(patient_img)</div><div>mask_img = masker_fit.mask_img_</div><div><br></div><div>Thanks in advance,</div><div><br></div><div><br></div><div>Gabriel</div><div><br></div><div><br></div><div><br></div><div></div></div></div>
</blockquote></div></div></div><br></div>
<br>______________________________<wbr>_________________<br>
Neuroimaging mailing list<br>
<a href="mailto:Neuroimaging@python.org">Neuroimaging@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/neuroimaging</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--<br>Christophe Pallier <<a href="mailto:christophe@pallier.org" target="_blank">christophe@pallier.org</a>><br>INSERM-CEA Cognitive Neuroimaging Lab, Neurospin, bat 145,<br>91191 Gif-sur-Yvette Cedex, France<br>Tel: 00 33 1 69 08 79 34<br>Personal web site: <a href="http://www.pallier.org" target="_blank">http://www.pallier.org</a><br>Lab web site: <a href="http://www.unicog.org" target="_blank">http://www.unicog.org</a><br></div>
</div>