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

Marijn van Vliet w.m.vanvliet at gmail.com
Tue Jun 23 01:38:19 EDT 2020
Search archives:

        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> 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
> 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/20200623/2f40c04f/attachment.html 


More information about the Mne_analysis mailing list