<div dir="ltr"><div>I've had at this a little bit more and my current suspicion is that this behavior is the result of an interaction between our remote desktop service (x2go) and Mayavi.<br><br></div>I created a an identical Miniconda environment for Pysurfer on both our server and my laptop and ran the following code to test this theory:<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"># The Basic Visualization demo from the Pysurfer gallery.<br>from surfer import Brain<br><br>print(__doc__)<br><br>"""<br>Define the three important variables.<br>Note that these are the first three positional arguments<br>in tksurfer (and pysurfer for that matter).<br>"""<br>subject_id = 'fsaverage'<br>hemi = 'lh'<br>surface = 'inflated'<br><br>"""<br>Call the Brain object constructor with these<br>parameters to initialize the visualization session.<br>"""<br>brain = Brain(subject_id, hemi, surface)<br><br># Save an image out to /tmp<br>print 'Saving out an image to /tmp using Brain.save_image.'<br>brain.save_image('/tmp/brain.png')<br><br># Looking at just the screenshot method of pysurfer's Brain object.<br># This is called by save_image and is fed into scipy.misc.imsave.<br># If the boolean expression evaluated here is true, then only a black<br># background is being fed into scipy's misc.imsave method for evaluation.<br>x = brain.screenshot()<br>print 'Test pysurfer\'s Brain.screenshot.'<br>if sum(x.flatten()==0)!=len(x.flatten()):<br>    print 'Pass'<br>else:<br>    print 'Fail'<br><br># Looking at the Mayavi mlab.screenshot method. <br># This is called by screenshot_single, which is called by Brain's screenshot.<br># If the boolean expression evaluated here is true, then only a black<br># background is being fed into Brain.screenshot()<br>from mayavi import mlab<br>x = mlab.screenshot(brain.brain_matrix[0,0]._f, 'rgb', False)<br>print 'Test mayavi\'s mlab.screenshot'<br>if sum(x.flatten()==0)!=len(x.flatten()):<br>    print 'Pass'<br>else:<br>    print 'Fail'<br></blockquote><div><div><div class="gmail_extra"><br></div><div class="gmail_extra">On the server through an x2go session both Brain.screenshot and mlab.screenshot failed to produce a non-blank image, while on my laptop's local environment both of these methods did produce the desired output (i.e., there were some nonzero outputs).<br><br></div><div class="gmail_extra">Since this doesn't seem to be an error with pysurfer in particular, I'm going to proceed to see if anyone using Mayavi with x2go or nx has encountered similar issues by querying their forums / issue pages.  I just wanted to leave this here if someone else encounters the same issue in the future.<br><br></div><div class="gmail_extra">--John<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 13, 2016 at 1:24 PM, John Pellman <span dir="ltr"><<a target="_blank" href="mailto:pellman.john@gmail.com">pellman.john@gmail.com</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr">It looks like it might be related to the following issue described at StackOverflow:<br><br><a target="_blank" href="http://stackoverflow.com/questions/16543634/mayavi-mlab-savefig-gives-an-empty-image">http://stackoverflow.com/quest<wbr>ions/16543634/mayavi-mlab-<wbr>savefig-gives-an-empty-image</a><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 12, 2016 at 2:00 PM, John Pellman <span dir="ltr"><<a target="_blank" href="mailto:pellman.john@gmail.com">pellman.john@gmail.com</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr"><div><div><div><div><div><div><div><div>Hi all,<br><br></div>I'm encountering a peculiar Pysurfer error on our server and I was wondering if anyone has encountered anything similar or might have some insight into how I can tackle it.  Basically, when our researchers try to save a png image using Brain.save_image() or Brain.save_imageset() the images produced only contain the background color (as you may have inferred from the subject line).  I've traced this back to Scipy method (scipy.misc.imsave), but it looks like this would only output an empty png if the image passed in were completely zeroed out.  Our setup uses the following versions of pysurfer/its dependencies:<br><br></div>Numpy: 1.10.0.dev0+1fe98ff<br></div>Scipy: 0.17.0.dev0+f2f6e48<br></div>Ipython: 3.1.0<br></div><div>nibabel: 2.0.0<br></div><div>Mayavi: 4.4.2<br></div><div>matplotlib: 1.4.3<br></div><div>PIL: 1.1.7<br></div>Pysurfer: 0.5<br><br></div>This setup is running within a Miniconda environment using Python 2.7.11.  I'm uncertain if this is related, but running the example code <a target="_blank" href="http://pysurfer.github.io/examples/plot_basics.html">here</a> produces the following warning:<br><br><i>(ipython:20765): Gdk-WARNING **: /build/buildd/gtk+2.0-2.24.27/<wbr>gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window</i><br><br>Any insight would be greatly appreciated.<br><br></div>Best,<br></div>John Pellman<br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>