[Neuroimaging] NILEARN - WHY THIS CODE THROWS AN ERROR?????

Matthew Brett matthew.brett at gmail.com
Fri Jul 8 11:05:51 EDT 2022


Hi,

‪On Fri, Jul 8, 2022 at 3:35 PM ‫נתי שטרן‬‎ <nsh531 at gmail.com> wrote:‬
>
> HOW TO DO THIS?
> I'm new in numpy :)
>
> ‫בתאריך יום ו׳, 8 ביולי 2022 ב-16:55 מאת ‪Christopher Markiewicz‬‏ <‪markiewicz at stanford.edu‬‏>:‬
>>
>> A lack of traceback makes it difficult to see where the error is occurring, but I believe the issue is that you're passing a numpy array to a nilearn function that expects an image.
>>

Chris is right I think - the error probably comes from your line:

>                 plot.plot_img(aleph)

`aleph` is an array, but that Nilearn function expects a "Niimg-like
object" not an array:

https://nilearn.github.io/stable/modules/generated/nilearn.plotting.plot_img.html#nilearn.plotting.plot_img

https://nilearn.github.io/dev/manipulating_images/input_output.html

But, as a meta-point - I highly recommend this article about asking
good questions.  In particular - please remember that we are all
volunteers, and most of us are very busy - so we very much appreciate
it when you show us you've investigated fairly carefully already, and
what you've tried:

http://catb.org/%7Eesr/faqs/smart-questions.html

Cheers,

Matthew


More information about the Neuroimaging mailing list