<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Thank you so much! Both of them were helpful. <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
-Manorama<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> mne_analysis-bounces@nmr.mgh.harvard.edu &lt;mne_analysis-bounces@nmr.mgh.harvard.edu&gt; on behalf of Marijn van Vliet &lt;w.m.vanvliet@gmail.com&gt;<br>
<b>Sent:</b> Tuesday, June 23, 2020 1:38 AM<br>
<b>To:</b> mne_analysis@nmr.mgh.harvard.edu &lt;mne_analysis@nmr.mgh.harvard.edu&gt;<br>
<b>Subject:</b> Re: [Mne_analysis] How to save a Brain object as a file</font>
<div>&nbsp;</div>
</div>
<div>
<p><span style="padding:3px 10px; border-radius:5px; color:#ffffff; font-weight:bold; display:inline-block; background-color:#ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
<p></p>
<p>And PySurfer uses Mayavi for the actual plotting. So even easier is to use:</p>
<p>from mayavi import mlab<br>
mlab.savefig('my_brain.png')</p>
<p><a class="x_moz-txt-link-freetext" href="https://docs.enthought.com/mayavi/mayavi/auto/mlab_figure.html#savefig">https://docs.enthought.com/mayavi/mayavi/auto/mlab_figure.html#savefig</a><br>
</p>
<div class="x_moz-cite-prefix">On 23/06/2020 02:21, Dan McCloy wrote:<br>
</div>
<blockquote type="cite">
<p><span style="padding:3px 10px; border-radius:5px; color:#ffffff; font-weight:bold; display:inline-block; background-color:#ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
<div>The output of stc.plot() is a pysurfer.Brain object, so screenshot() is documented in the PySurfer docs, not the MNE-Python docs:&nbsp;
<a href="https://pysurfer.github.io/generated/surfer.Brain.html#surfer.Brain.screenshot">
https://pysurfer.github.io/generated/surfer.Brain.html#surfer.Brain.screenshot</a><br>
</div>
<div><br>
</div>
<div>Note that screenshot() does not save an image file, it &quot;saves&quot; the pixels as a NumPy array of RGB values, and assigns them to a variable.&nbsp; It does not create any files on disk.&nbsp; If you want to save it to disk, passing the variable to
<a rel="nofollow" title="https://matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.imsave.html" target="_blank" href="https://matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.imsave.html">
matplotlib's plt.imsave()</a> is probably easiest.<br>
</div>
<div><br>
</div>
<div class="x_protonmail_signature_block">
<div class="x_protonmail_signature_block-user">
<div>-- dan<br>
</div>
<div>Daniel McCloy<br>
</div>
<div><a class="x_moz-txt-link-freetext" href="https://dan.mccloy.info">https://dan.mccloy.info</a><br>
</div>
<div>Research Scientist<br>
</div>
<div>Institute for Learning and Brain Sciences<br>
</div>
<div>University of Washington<br>
</div>
</div>
<div class="x_protonmail_signature_block-proton x_protonmail_signature_block-empty">
<br>
</div>
</div>
<div><br>
</div>
<div>$B!>!>!>!>!>!>!>(B Original Message $B!>!>!>!>!>!>!>(B<br>
</div>
<div>On Monday, June 22, 2020 3:57 PM, Kadwani, Manorama <a class="x_moz-txt-link-rfc2396E" href="mailto:MKADWANI@mgh.harvard.edu">
&lt;MKADWANI@mgh.harvard.edu&gt;</a> wrote:<br>
</div>
<div><br>
</div>
<blockquote class="x_protonmail_quote" type="cite">
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
Hi,<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
I plotted source activation using the stc.plot() function as described here in: <a href="https://mne.tools/stable/auto_examples/visualization/plot_publication_figure.html">
https://mne.tools/stable/auto_examples/visualization/plot_publication_figure.html</a>
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
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.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
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?<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
Thanks,<br>
</div>
<div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Manorama Kadwani<br>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<br>
<fieldset class="x_mimeAttachmentHeader"></fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
Mne_analysis mailing list
<a class="x_moz-txt-link-abbreviated" href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.edu</a>
<a class="x_moz-txt-link-freetext" href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></pre>
</blockquote>
</div>
</body>
</html>