<div class="gmail_extra"><br><div class="gmail_quote">On Sep 16, 2016 4:13 PM, "Roan LaPlante" <<a href="mailto:aestrivex@gmail.com">aestrivex@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">That's weird, I use xvfb with pysurfer to plot in a headless context regularly.</p>
<p dir="ltr">Have you confirmed that there is not a missing or outdated library version? What python distribution are you running? </p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 16, 2016 3:55 PM, "John Pellman" <<a href="mailto:pellman.john@gmail.com" target="_blank">pellman.john@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Running the basic visualization code for Pysurfer followed by Brain.save_image() gave the following results with when run with xvfbwrapper:<br><br></div>On the server under x2go/nx : An all-black image.<br>On the server under a regular ssh session : An all-black image.<br></div>On my local computer: An all-black image.<br><br></div>So it doesn't look like that's going to work. :/<br><br></div>wxPython is also installed- is it possible that that is affecting the image rendering too?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 16, 2016 at 2:36 PM, Roan LaPlante <span dir="ltr"><<a href="mailto:rlaplant@nmr.mgh.harvard.edu" target="_blank">rlaplant@nmr.mgh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">If that's the problem, xvfb should still be a viable workaround in the nx context, right? </p>
<div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Sep 16, 2016 12:30 PM, "Gael Varoquaux" <<a href="mailto:gael.varoquaux@normalesup.org" target="_blank">gael.varoquaux@normalesup.org</a><wbr>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Nx has always been a problem with Mayavi (or actually VTK, which is the<br>
underlying technology). Basically, it interfers with the openGL contexts,<br>
and in some cases the buffer cannot be captured well. Hence the black<br>
image.<br>
<br>
IMHO, the bug is in NX or the mesa driver, or both.<br>
<br>
Gaël<br>
<br>
On Fri, Sep 16, 2016 at 12:00:15PM -0400, John Pellman wrote:<br>
> Pysurfer isn't running headless- it's using x2go, which is based upon the nx<br>
> protocol, a technology that improves the ability of X11 to function over a<br>
> network connection. Therefore, I don't think that Xvfb is related.  xvfbwrapper<br>
> might be usable as a workaround, however.<br>
<br>
> As I mentioned in my last post, I traced the offending method back to mayavi. <br>
> I've opened an issue related to this here.<br>
<br>
> Kirstie- if you'd be willing to refer your sysadmin to this thread I think that<br>
> would be great, as I would be interested in hearing what theories or potential<br>
> fixes he/she might have for this issue as well.<br>
<br>
> --John<br>
<br>
> On Fri, Sep 16, 2016 at 5:43 AM, JB Poline <<a href="mailto:jbpoline@gmail.com" target="_blank">jbpoline@gmail.com</a>> wrote:<br>
<br>
>     That's a cool idea and package - thanks for pointing to this !<br>
<br>
>     On 16 September 2016 at 02:40, Ariel Rokem <<a href="mailto:arokem@gmail.com" target="_blank">arokem@gmail.com</a>> wrote:<br>
<br>
<br>
>         On Thu, Sep 15, 2016 at 1:33 PM, Kirstie Whitaker <<a href="mailto:kw401@cam.ac.uk" target="_blank">kw401@cam.ac.uk</a>><br>
>         wrote:<br>
<br>
>             Hi John,<br>
<br>
>             I'm travelling at the moment but I've had problems with pysurfer<br>
>             showing beautiful brains on the screen but only saving a black box<br>
>             to file. It happened right after our systems admin updated a few<br>
>             things but I haven't been able to get a clear list from him of what<br>
>             changed except: everything should work.<br>
<br>
>             My point with this email is please do share back what you<br>
>             learn.....even if it ends up being not a pysurfer problem. At the<br>
>             moment my workaround is to move everything I do to a different<br>
>             cluster that works!! Non efficient to say the least!<br>
<br>
>             Thank you<br>
>             Kirstie <br>
<br>
>             Sent from my iPhone, please excuse any typos or excessive brevity<br>
<br>
>             On 15 Sep 2016, at 12:44, John Pellman <<a href="mailto:pellman.john@gmail.com" target="_blank">pellman.john@gmail.com</a>><br>
>             wrote:<br>
<br>
<br>
>                 I've had at this a little bit more and my current suspicion is<br>
>                 that this behavior is the result of an interaction between our<br>
>                 remote desktop service (x2go) and Mayavi.<br>
<br>
>                 I created a an identical Miniconda environment for Pysurfer on<br>
>                 both our server and my laptop and ran the following code to<br>
>                 test this theory:<br>
<br>
<br>
>                     # 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<br>
>                     object.<br>
>                     # This is called by save_image and is fed into<br>
>                     scipy.misc.imsave.<br>
>                     # If the boolean expression evaluated here is true, then<br>
>                     only a black<br>
>                     # background is being fed into scipy's misc.imsave method<br>
>                     for evaluation.<br>
>                     x = brain.screenshot()<br>
>                     print 'Test pysurfer\'s Brain.screenshot.'<br>
>                     if sum(x.flatten()==0)!=len(x.fla<wbr>tten()):<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<br>
>                     Brain's screenshot.<br>
>                     # If the boolean expression evaluated here is true, then<br>
>                     only a black<br>
>                     # background is being fed into Brain.screenshot()<br>
>                     from mayavi import mlab<br>
>                     x = mlab.screenshot(brain.brain_ma<wbr>trix[0,0]._f, 'rgb',<br>
>                     False)<br>
>                     print 'Test mayavi\'s mlab.screenshot'<br>
>                     if sum(x.flatten()==0)!=len(x.fla<wbr>tten()):<br>
>                         print 'Pass'<br>
>                     else:<br>
>                         print 'Fail'<br>
<br>
<br>
>                 On the server through an x2go session both Brain.screenshot and<br>
>                 mlab.screenshot failed to produce a non-blank image, while on<br>
>                 my laptop's local environment both of these methods did produce<br>
>                 the desired output (i.e., there were some nonzero outputs).<br>
<br>
>                 Since this doesn't seem to be an error with pysurfer in<br>
>                 particular, I'm going to proceed to see if anyone using Mayavi<br>
>                 with x2go or nx has encountered similar issues by querying<br>
>                 their forums / issue pages.  I just wanted to leave this here<br>
>                 if someone else encounters the same issue in the future.<br>
<br>
<br>
>         A shot in the dark: Could it be something to do with running headless?<br>
>         Maybe running this under XVFB (e.g. through xvfbwrapper) would help? <br>
<br>
>         Ariel <br>
>          <br>
<br>
>                 --John<br>
<br>
>                 On Tue, Sep 13, 2016 at 1:24 PM, John Pellman <<br>
>                 <a href="mailto:pellman.john@gmail.com" target="_blank">pellman.john@gmail.com</a>> wrote:<br>
<br>
>                     It looks like it might be related to the following issue<br>
>                     described at StackOverflow:<br>
<br>
>                     <a href="http://stackoverflow.com/questions/16543634/" rel="noreferrer" target="_blank">http://stackoverflow.com/ques<wbr>tions/16543634/</a><br>
>                     mayavi-mlab-savefig-gives-an-<wbr>empty-image<br>
<br>
>                     On Mon, Sep 12, 2016 at 2:00 PM, John Pellman <<br>
>                     <a href="mailto:pellman.john@gmail.com" target="_blank">pellman.john@gmail.com</a>> wrote:<br>
<br>
>                         Hi all,<br>
<br>
>                         I'm encountering a peculiar Pysurfer error on our<br>
>                         server and I was wondering if anyone has encountered<br>
>                         anything similar or might have some insight into how I<br>
>                         can tackle it.  Basically, when our researchers try to<br>
>                         save a png image using Brain.save_image() or<br>
>                         Brain.save_imageset() the images produced only contain<br>
>                         the background color (as you may have inferred from the<br>
>                         subject line).  I've traced this back to Scipy method<br>
>                         (scipy.misc.imsave), but it looks like this would only<br>
>                         output an empty png if the image passed in were<br>
>                         completely zeroed out.  Our setup uses the following<br>
>                         versions of pysurfer/its dependencies:<br>
<br>
>                         Numpy: 1.10.0.dev0+1fe98ff<br>
>                         Scipy: 0.17.0.dev0+f2f6e48<br>
>                         Ipython: 3.1.0<br>
>                         nibabel: 2.0.0<br>
>                         Mayavi: 4.4.2<br>
>                         matplotlib: 1.4.3<br>
>                         PIL: 1.1.7<br>
>                         Pysurfer: 0.5<br>
<br>
>                         This setup is running within a Miniconda environment<br>
>                         using Python 2.7.11.  I'm uncertain if this is related,<br>
>                         but running the example code here produces the<br>
>                         following warning:<br>
<br>
>                         (ipython:20765): Gdk-WARNING **: /build/buildd/<br>
>                         gtk+2.0-2.24.27/gdk/x11/gdkdr<wbr>awable-x11.c:952 drawable<br>
>                         is not a pixmap or window<br>
<br>
>                         Any insight would be greatly appreciated.<br>
<br>
>                         Best,<br>
>                         John Pellman<br>
<br>
<br>
<br>
<br>
<br>
>                 _____________________________<wbr>__________________<br>
>                 Neuroimaging mailing list<br>
>                 <a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
>                 <a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailm<wbr>an/listinfo/neuroimaging</a><br>
<br>
<br>
>             _____________________________<wbr>__________________<br>
>             Neuroimaging mailing list<br>
>             <a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
>             <a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailm<wbr>an/listinfo/neuroimaging</a><br>
<br>
<br>
<br>
<br>
>         _____________________________<wbr>__________________<br>
>         Neuroimaging mailing list<br>
>         <a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
>         <a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailm<wbr>an/listinfo/neuroimaging</a><br>
<br>
<br>
<br>
<br>
>     _____________________________<wbr>__________________<br>
>     Neuroimaging mailing list<br>
>     <a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
>     <a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailm<wbr>an/listinfo/neuroimaging</a><br>
<br>
<br>
<br>
<br>
> ______________________________<wbr>_________________<br>
> Neuroimaging mailing list<br>
> <a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/neuroimaging</a><br>
<br>
<br>
--<br>
    Gael Varoquaux<br>
    Researcher, INRIA Parietal<br>
    NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France<br>
    Phone:  <a href="tel:%2B%2B%2033-1-69-08-79-68" value="+33169087968" target="_blank">++ 33-1-69-08-79-68</a><br>
    <a href="http://gael-varoquaux.info" rel="noreferrer" target="_blank">http://gael-varoquaux.info</a>            <a href="http://twitter.com/GaelVaroquaux" rel="noreferrer" target="_blank">http://twitter.com/GaelVaroqua<wbr>ux</a><br>
______________________________<wbr>_________________<br>
Neuroimaging mailing list<br>
<a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/neuroimaging</a><br>
<br>
<br>
<br></div></div>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/compli<wbr>anceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
<br>
</blockquote></div></div>
<br>______________________________<wbr>_________________<br>
Neuroimaging mailing list<br>
<a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/neuroimaging</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Neuroimaging mailing list<br>
<a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/neuroimaging</a><br>
<br>
<br>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/compli<wbr>anceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
<br></blockquote></div></div>
</blockquote></div></div>