[Neuroimaging] [External] Re: Nifti File

Winter, Matthew mattwint at iu.edu
Thu Jun 4 15:16:34 EDT 2020


Thanks so much Eric, that worked very well.

From: Eric Larson<mailto:larson.eric.d at gmail.com>
Sent: Wednesday, June 3, 2020 4:56 PM
To: Neuroimaging analysis in Python<mailto:neuroimaging at python.org>
Subject: [External] Re: [Neuroimaging] Nifti File

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

Looking at the docs for `cwt`:

https://mne.tools/stable/generated/mne.time_frequency.tfr.cwt.html

It just wants an `ndarray` of the right shape. `img.get_fdata()` in nibabel followed by `np.reshape` to get it to be 2D of shape (n_signals, n_times) and you should be good to go (and reshape back to the 4D image shape if you want).

But this is going to be quite slow because there are so many signals, you're probably better off computing the CWT of the MEG sensor data, keeping it complex, then using linearity of the inverse to get it to source space (including an MRI image, if you want) then taking the magnitude, assuming you want that. Also, assuming that the MRI data are the *magnitude* (abs) of the response at the given voxel -- I haven't worked with HCP MRI images so I don't know -- doing the CWT of this is going to be problematic because of the nonlinearity of the magnitude operation... if on the other hand they are signed (e.g., the result of a max-power-ori LCMV or something) then doing it in source or sensor space (then projecting to source space) should be equivalent, but the former will be much slower than the latter.

Eric


On Tue, Jun 2, 2020 at 2:59 PM Winter, Matthew <mattwint at iu.edu<mailto:mattwint at iu.edu>> wrote:
Hi,
I am trying to do a time-frequency continuous wave transform on the Nifti files provided by the final pipeline in the Human Connectome Project's MEG N-back task. I am working in MNE and trying to use their mne.time_frequency.tfr.cwt(). I have loaded the Nifti files into MNE, but am unaware of how to get the Nifti's into the right format to be used by MNE functions that typically use .fif files. Is there a nibable function that could help with this process? Thank you for any advice.
Best,
Matt


_______________________________________________
Neuroimaging mailing list
Neuroimaging at python.org<mailto:Neuroimaging at python.org>
https://mail.python.org/mailman/listinfo/neuroimaging
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200604/725b9f7d/attachment.html>


More information about the Neuroimaging mailing list