[Mne_analysis] How to save a Brain object as a file

Kadwani, Manorama MKADWANI at mgh.harvard.edu
Wed Jun 24 10:05:28 EDT 2020
Search archives:

Thank you so much! Both of them were helpful.
-Manorama
________________________________
From: mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Marijn van Vliet <w.m.vanvliet at gmail.com>
Sent: Tuesday, June 23, 2020 1:38 AM
To: mne_analysis at nmr.mgh.harvard.edu <mne_analysis at nmr.mgh.harvard.edu>
Subject: Re: [Mne_analysis] How to save a Brain object as a file


        External Email - Use Caution

And PySurfer uses Mayavi for the actual plotting. So even easier is to use:

from mayavi import mlab
mlab.savefig('my_brain.png')

https://docs.enthought.com/mayavi/mayavi/auto/mlab_figure.html#savefig

On 23/06/2020 02:21, Dan McCloy wrote:

        External Email - Use Caution

The output of stc.plot() is a pysurfer.Brain object, so screenshot() is documented in the PySurfer docs, not the MNE-Python docs:  https://pysurfer.github.io/generated/surfer.Brain.html#surfer.Brain.screenshot

Note that screenshot() does not save an image file, it "saves" the pixels as a NumPy array of RGB values, and assigns them to a variable.  It does not create any files on disk.  If you want to save it to disk, passing the variable to matplotlib's plt.imsave()<https://matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.imsave.html> is probably easiest.

-- dan
Daniel McCloy
https://dan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, June 22, 2020 3:57 PM, Kadwani, Manorama <MKADWANI at mgh.harvard.edu><mailto:MKADWANI at mgh.harvard.edu> wrote:

Hi,

I plotted source activation using the stc.plot() function as described here in: https://mne.tools/stable/auto_examples/visualization/plot_publication_figure.html
I want to save the plots in a certain directory as a file, with a certain name. The website used the 'screenshot()' function for the Brain object.
But I couldn't find any documentation on the screenshot() function describing its attributes. How do I specify the directory, or the figure size, or resolution?

Thanks,
Manorama Kadwani




_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu<mailto:Mne_analysis at nmr.mgh.harvard.edu>
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200624/2e5f4b8f/attachment.html 


More information about the Mne_analysis mailing list