Hello, I have a set of simple python scripts that do everything I need by applying overlay to MRI images and saving the resulting images. I would like to execute MRIcroGL WITHOUT the GUI. I know that I can start the execution from the command line but it looks like MRIcroGL always start the GUI even if the script does not require it. It looks like there is no option from the command line to turn off the GUI. Any possible trick?
Thanks in advance and best regards,
Mario
Sorry, I do not know if it is possible to run MRIcroGL in headless mode. You might want to try fsleyes. Alternatively, you may want to try out the javascript NiiVue
https://niivue.github.io/niivue/
Notice that many of the node.js tests simply generate a bitmap as their output:
https://github.com/niivue/niivue/tree/ma...
Since NiiVue is based on JavaScript, it is easy to script. The emergent ipyniivue embeds NiiVue into a jupyter notebook, which may be what you are looking for. Being based on WebGL2, ipyniivue embeds directly into the jupyter notebooks.
Thanks for your reply. I found an alternative by using a "dummy" X server. Basically, the graphical output is discarded. Unfortunately, exactly the same script produces two images with different width and height even (the size is different). I attach a zip with the script and the two images (produced with the X11 active and without X11).
Is there any way to force the same resolution I have with X11 even without X11?
Thanks again and best regards,
Mario
For saving images for publication you should always use the mosaic view. The other views are scaled based on the size of your window and the resolution of your monitor. In contrast, the mosaic views height and width in pixels is determined by the base resolution of your image, reducing aliasing artifacts. I generally also use a bitmap zoom of 1 for a 1-to-1 correspondence of voxels to pixels for isotropic images:
gl.bmpzoom(1)
gl.mosaic("A L+ H -0.2 -24 -16 16 40; 48 56 S X R 0");
In general, I use a vector graphics tool to add text and numbers to title bars. If you are fine with bitmapped numbers, you may prefer a higher bitmap zoom, for example you will get four times as many pixels (2x2) with
gl.bmpzoom(2)
gl.mosaic("A L+ H -0.2 -24 -16 16 40; 48 56 S X R 0");