dfsp-spirit / fsbrain

R library for structural neuroimaging. Provides high-level functions to access (read and write) and visualize surface-based brain morphometry data for individuals and groups.
Other
65 stars 13 forks source link

Export directly #41

Closed mattsodoma closed 2 years ago

mattsodoma commented 2 years ago

Hello, Thank you for the great visualization package. I would like to use this package with our high performance cluster as part of a pipeline. Currently, I have it working on my desktop locally, but run into issues when not being able to render images. Is it possible to create the 2D images and save directly without opening up the RGL windows? This is the point of failure when I try to script it on the cluster. Thanks! Matt

dfsp-spirit commented 2 years ago

Hi Matt,

so you are trying to render on a headless box, right? That should be possible and there is an example in the docker scripts.

But even if you don't have an OpenGL window, you will need something to render to. I think the docker examples use a virtual framebuffer.

I'm currently on mobile, but I will link you to the appropriate example later at work when have a computer.

Tim

mattsodoma commented 2 years ago

Hi Tim, Thank you for the response. Yes, what you are describing with docker seems applicable. I believe the export fails because it is unable to open the additional rgl window to take snapshots. Essentially, wondering if it can render in silent and/or export the image into png without opening up the rgl windows... which sounds like it might do something like that in docker. Matt

dfsp-spirit commented 2 years ago

Here is an example that uses xvfb (instead of a real, visible X11 window) to render to:

https://github.com/dfsp-spirit/fsbrain/tree/master/web/fsbrain_xvfb_demo

A demo that uses xvfb inside a docker container can be found here, but you may want to use this with the latest docker image available in the parent dir.

dfsp-spirit commented 2 years ago

@mattsodoma Did this help?

mattsodoma commented 2 years ago

Hi Tim, Sorry I haven't had a chance to revisit this but I appreciate the response. I've just been running it locally when I need to process images and wont be at my computer for awhile.. Unfortunately, our cluster won't run with docker, only singularity, and I haven't had time or know enough about rgl to figure out the kinks of converting this container to singularity to see if it works after conversion. Matt