You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to learn about MVPA and nilearn and am encountering a problem. I have an event-related design so I followed the recommendation to create trial-specific regressors (used SPM 12), which gave me a beta image for each trial event.
I created a mask using SPM 12 neuromorphometric atlas in order to restrict the analysis to an ROI. When I come to use NiftiMasker to apply this mask to any of the beta images it provides this warning:
C:\Users\L\AppData\Roaming\Python\Python37\site-packages\nilearn\image\resampling.py:584: RuntimeWarning: NaNs or infinite values are present in the data passed to resample. This is a bad thing as they make resampling ill-defined and much slower.
fill_value=fill_value)
C:\Users\L\AppData\Roaming\Python\Python37\site-packages\nilearn\image\resampling.py:591: RuntimeWarning: invalid value encountered in greater
vmin = min(data.min(), 0)
C:\Users\L\AppData\Roaming\Python\Python37\site-packages\nilearn\image\resampling.py:592: RuntimeWarning: invalid value encountered in less
vmax = max(data.max(), 0)
C:\Users\L\AppData\Roaming\Python\Python37\site-packages\nilearn\signal.py:61: UserWarning: Standardization of 3D signal has been requested but would lead to zero values. Skipping.
warnings.warn('Standardization of 3D signal has been requested but '
I believe this has something to do with how SPM 12 uses NaN to represent the values outside of the brain, but I could be wrong. I tried nilearn.image.clean_img() but received an error because this expects a 4D array - my data are 3D betas since it was event related. In any case, I see that there is the argument ensure_finite when calling the apply_mask() which is by default True, so then I'm not sure why I receive this warning/error.
I guess I could read in the data using nibabel.load() and then manually set the NaN values to zeros but I want to apply the mask to all of my betas and the NiftiMasker expects a filename rather than an array. Maybe I could do this and re-save the beta file.
Normally, if you run nilearn.image.clean_img() on the list of all images,this is equivalent to running it on a 4D image. This should do the trick. Can you confirm ?
Also, we should have this kind of discussion on the Neurostars site rather than the Nilearn issue tracker.
Best,
Hi
I am trying to learn about MVPA and nilearn and am encountering a problem. I have an event-related design so I followed the recommendation to create trial-specific regressors (used SPM 12), which gave me a beta image for each trial event.
I created a mask using SPM 12 neuromorphometric atlas in order to restrict the analysis to an ROI. When I come to use
NiftiMasker
to apply this mask to any of the beta images it provides this warning:I believe this has something to do with how SPM 12 uses NaN to represent the values outside of the brain, but I could be wrong. I tried
nilearn.image.clean_img()
but received an error because this expects a 4D array - my data are 3D betas since it was event related. In any case, I see that there is the argumentensure_finite
when calling theapply_mask()
which is by defaultTrue
, so then I'm not sure why I receive this warning/error.I guess I could read in the data using
nibabel.load()
and then manually set the NaN values to zeros but I want to apply the mask to all of my betas and theNiftiMasker
expects a filename rather than an array. Maybe I could do this and re-save the beta file.I am unable to attach a couple of my beta.nii but happy to email if it helps. Here is a link to a notebook that has a minimal example with outputs to see - hope it is helpful.
The text was updated successfully, but these errors were encountered: