<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 15, 2016 at 1:33 PM, Kirstie Whitaker <span dir="ltr"><<a href="mailto:kw401@cam.ac.uk" target="_blank">kw401@cam.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><div style="direction:inherit">Hi John,</div><div style="direction:inherit"><br></div><div style="direction:inherit">I'm travelling at the moment but I've had problems with pysurfer showing beautiful brains on the screen but only saving a black box to file. It happened right after our systems admin updated a few things but I haven't been able to get a clear list from him of what changed except: everything should work.</div><div style="direction:inherit"><br></div><div style="direction:inherit">My point with this email is please do share back what you learn.....even if it ends up being not a pysurfer problem. At the moment my workaround is to move everything I do to a different cluster that works!! Non efficient to say the least!</div><div style="direction:inherit"><br></div><div style="direction:inherit">Thank you</div><div style="direction:inherit">Kirstie </div><br>Sent from my iPhone, please excuse any typos or excessive brevity</div><div><div class="gmail-h5"><div><br>On 15 Sep 2016, at 12:44, John Pellman <<a href="mailto:pellman.john@gmail.com" target="_blank">pellman.john@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><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.<wbr>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.<wbr>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_<wbr>matrix[0,0]._f, 'rgb', False)<br>print 'Test mayavi\'s mlab.screenshot'<br>if sum(x.flatten()==0)!=len(x.<wbr>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></div></div></div></blockquote></div></div></div></blockquote><div>A shot in the dark: Could it be something to do with running headless? Maybe running this under XVFB (e.g. through <a href="https://pypi.python.org/pypi/xvfbwrapper">xvfbwrapper</a>) would help? </div><div><br></div><div>Ariel </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><div class="gmail-h5"><blockquote type="cite"><div><div dir="ltr"><div><div><div class="gmail_extra"></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 href="mailto:pellman.john@gmail.com" target="_blank">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 href="http://stackoverflow.com/questions/16543634/mayavi-mlab-savefig-gives-an-empty-image" target="_blank">http://stackoverflow.com/quest<wbr>ions/16543634/mayavi-mlab-save<wbr>fig-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 href="mailto:pellman.john@gmail.com" target="_blank">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 href="http://pysurfer.github.io/examples/plot_basics.html" target="_blank">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>
</div></blockquote></div></div><blockquote type="cite"><div><span>______________________________<wbr>_________________</span><br><span>Neuroimaging mailing list</span><br><span><a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a></span><br><span><a href="https://mail.python.org/mailman/listinfo/neuroimaging" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/neuroimaging</a></span><br></div></blockquote></div><br>______________________________<wbr>_________________<br>
Neuroimaging mailing list<br>
<a href="mailto:Neuroimaging@python.org">Neuroimaging@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/neuroimaging</a><br>
<br></blockquote></div><br></div></div>