mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.67k stars 1.31k forks source link

Visualizing brains in 3-D space? #2555

Closed choldgraf closed 7 years ago

choldgraf commented 8 years ago

I'm trying to figure out if it's feasible to visualize brains in 3-D space with python. I know there's a lot of software out there (e.g., freesurfer/pysurfer, or pycortex) that lets you do this with solid MR scans, but in my case I basically just have a Nifty file with pretty low-quality scans.

Is there any way in MNE (or python more generally) to just load a Nifty file of someone's brain reconstruction, a 3-D array of numbers denoting electrode positions, and then make scatterplots etc on top?

agramfort commented 8 years ago

the best way to visualize brain slices is with nilearn AFAIK.

we use it in http://martinos.org/mne/dev/auto_examples/inverse/plot_lcmv_beamformer_volume.html#sphx-glr-auto-examples-inverse-plot-lcmv-beamformer-volume-py

if you need more you'll need to code a bit.

On Sat, Oct 24, 2015 at 1:25 AM, Chris Holdgraf notifications@github.com wrote:

I'm trying to figure out if it's feasible to visualize brains in 3-D space with python. I know there's a lot of software out there (e.g., freesurfer/pysurfer, or pycortex) that lets you do this with solid MR scans, but in my case I basically just have a Nifty file with pretty low-quality scans.

Is there any way in MNE (or python more generally) to just load a Nifty file of someone's brain reconstruction, a 3-D array of numbers denoting electrode positions, and then make scatterplots etc on top?

— Reply to this email directly or view it on GitHub https://github.com/mne-tools/mne-python/issues/2555.

choldgraf commented 8 years ago

That looks useful - thanks for the tip. I basically want to do things like what you just linked to, only on a 3D brain w/ some orientation. There are a few packages that do this in matlab but I'm hoping something exists in python for this. Unfortunately the ECoG world is mostly a matlab world :P

On Sun, Oct 25, 2015 at 2:04 PM, Alexandre Gramfort < notifications@github.com> wrote:

the best way to visualize brain slices is with nilearn AFAIK.

we use it in

http://martinos.org/mne/dev/auto_examples/inverse/plot_lcmv_beamformer_volume.html#sphx-glr-auto-examples-inverse-plot-lcmv-beamformer-volume-py

if you need more you'll need to code a bit.

On Sat, Oct 24, 2015 at 1:25 AM, Chris Holdgraf notifications@github.com wrote:

I'm trying to figure out if it's feasible to visualize brains in 3-D space with python. I know there's a lot of software out there (e.g., freesurfer/pysurfer, or pycortex) that lets you do this with solid MR scans, but in my case I basically just have a Nifty file with pretty low-quality scans.

Is there any way in MNE (or python more generally) to just load a Nifty file of someone's brain reconstruction, a 3-D array of numbers denoting electrode positions, and then make scatterplots etc on top?

— Reply to this email directly or view it on GitHub https://github.com/mne-tools/mne-python/issues/2555.

— Reply to this email directly or view it on GitHub https://github.com/mne-tools/mne-python/issues/2555#issuecomment-150969067 .

agramfort commented 8 years ago

sounds like a good sunday hack :)

choldgraf commented 8 years ago

Hehe, something I am happy to assist somebody with if they want to do some co-hacking with me, but I have about 0 experience doing 3D plotting. Right now I just take a 2D snapshot of the brain, and use the mouse to click the X/Y coordinates of each electrode on that snapshot (which is stupid, I know)

agramfort commented 8 years ago

depends how often you need to do this :)

choldgraf commented 8 years ago

Well, at least once for every subject, but it means that if you ever want to change something about that picture (e.g., shrink it or blow it up, shift it, change the angle, etc) you have to redo the entire thing. Plus it just seems silly to take a full 3D representation of a brain, along with 3D electrode positions, and then throw all of that away in lieu of manually clicking an image.

choldgraf commented 8 years ago

I'm gonna ask the nibabel / nipy folks if they have any experience with Mayavi. I actually got this sort-of working, and if it becomes something stable then I'm happy to contribute it to MNE (e.g., some sort of high-level function that accepts a volumetric representation of a brain + x/y/z positions of electrodes). If you know of anyone with nibabel and/or mayavi experience, I'd love to shoot them questions :)

larsoner commented 7 years ago

I'm closing this one, as I think we have made progress on some fronts and opened more specific issues on others. @choldgraf if there are things in here that aren't covered elsewhere, please reopen and retitle

choldgraf commented 7 years ago

yes I think so - plenty of issues to be opened, but I think those are all on the Mayavi repo ;-)