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

Dan McCloy dan at mccloy.info
Mon Jun 22 19:21:19 EDT 2020
Search archives:

        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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200622/b85d4c21/attachment.html 


More information about the Mne_analysis mailing list