Remove parcellations on the back of the brain to show only parcellations in line of sight

Hi All, I am having difficuly with displaying parcellations on the brain corticol surface. I am making screenshots of this using the screenshot() function for brains in a medial and lateral view.

The problem I am facing is that a parcellation shown on the medial side also shines through to the lateral side, due to transparancy of the surface. I would like to block any parcellations showing on the other side of the hemisphere.

I a using these lines of code:
brain = Brain(‘fsaverage’, hemi=‘lh’, surf=‘pial’,
subjects_dir=subjects_dir, size=(320, 300), cortex = ‘classic’, background=‘white’, alpha=1, views=[‘lateral’], offscreen = True)

for e,check_label in enumerate(check_labels):
brain.add_label(check_label, alpha = 0.6, color = cmap(grades[0][e]))

screenshot_l = brain.screenshot(mode = ‘rgb’)
axs[1,0].imshow(screenshot_l)

  • MNE version:0.21.1
  • OS: Windows 10

Any help is greatly appreciated.

You can see here that the lateral part of Brodmann 6 is also visible on the medial surface (right), which is simply misleading to a naive viewer.

this is actually not due to the transparency of the cortex surface. It is a rendering bug that I’ve seen before (on laptops that had only integrated Intel graphics, not separate graphics cards). The first thing I would try is upgrading to MNE-Python 0.24 so that you can use the pyvista 3D backend instead of the mayavi 3D backend. I think (?) that might be enough to fix it, but if not, please report back here and provide some additional details about your system:

  1. the graphics card: you can do this through Device Manager > Display > Graphics Card > properties (I think that’s the right sequence), or by running command prompt as administrator and running wmic path win32_VideoController get name.
  2. the results of mne.sys_info()
1 Like

Oh, yes, I got that bug on two computers about a year ago, and at that time I could not solve it by upgrading mne (and I couldn’t easily switch to PyVista as I had substantial amount of mayavi-specific code). Interestingly, the laptop had a dedicated graphics card apart from the intergrated intel one, but maybe it was not used by default in mne? In my case trying a different machine helped, so you may also try that @TijmenWartenberg :slight_smile:

Thanks, I will try using your tips and switch from using the integrated graphics card.

@drammock
1.
latform: Windows-10-10.0.19041-SP0
Python: 3.8.10 (default, May 19 2021, 13:12:57) [MSC v.1916 64 bit (AMD64)]
Executable: C:\Users\move the brain\anaconda3\python.exe
CPU: Intel64 Family 6 Model 69 Stepping 1, GenuineIntel: 4 cores
Memory: 7.9 GB

mne: 0.21.1
numpy: 1.21.2 {blas=mkl_rt, lapack=mkl_rt}
scipy: 1.7.3
matplotlib: 3.3.4 {backend=Qt5Agg}

sklearn: 0.24.2
numba: Not found
nibabel: 3.2.0
cupy: Not found
pandas: 1.2.2
dipy: Not found
mayavi: 4.7.2
pyvista: Not found
vtk: 9.0.1
PyQt5: 5.12.3

  1. Intel(R) HD Graphics Family