- MNE-Python version: 0.23.0
- operating system: win10
I want to visualize the response of certain brain areas to stimuli, so I used the stc.plot() method to plot the brain image.
But I have 14subject400trails3bands*8timewindows=134,400 images in my experiment. If I display them one by one and use brain.save_image(), it will take a few days (even if the GPU is used).
So I want to know, is there any way to save the image without displaying the image?
thank you very much!
If you ask MNE-Python to use the
mayavi 3D engine instead of pyvista, then there is an option
mayavi.mlab.options.offscreen = True that you can set in your script. Note that 3D brain plots with mayavi do not have the same options as pyvista (i.e., things like
show_traces won’t work). But maybe that is good enough?
If using mayavi isn’t an option, then if you can find a Linux computer you can plot offscreen using pyvista by using
xvfb (the x virtual frame buffer) which creates a fake hidden “screen” where figures are “drawn” and then can be saved to file, without ever actually being displayed. (Windows doesn’t use the X windowing system, so xvfb doesn’t work at all on Windows).
In theory it would be possible (I think?) for us to instantiate the
pyvista.BackgroundPlotter with the option (
show=False) if users wanted that… @GuillaumeFavelier would know best whether exposing this option would be easy or possible.
I used the mayavi backend to draw the image but the following error is displayed. Do you know why?
I tried to look at the source code, but I didn’t find the reason.
It may be the reason of the parameter views=‘axial’. I can draw the image by deleting this, but the image is not what I want. I will carefully study how to restore the view angle of the image to normal.
see https://pysurfer.github.io/auto_examples/show_views.html for allowed view names.
specifically, they are