[BUG] `mne.viz.Brain` volume rendering doesn't show up
See original GitHub issueIf you don’t set alpha=0, you get an opaque inflated brain along with your volume source estimate. I think the default arguments could handle this better.

To replicate:
import mne
from mne.datasets import sample
from mne import read_evokeds
from mne.minimum_norm import apply_inverse, read_inverse_operator
data_path = sample.data_path()
meg_path = data_path / 'MEG' / 'sample'
fname_inv = meg_path / 'sample_audvis-meg-vol-7-meg-inv.fif'
fname_evoked = meg_path / 'sample_audvis-ave.fif'
snr = 3.0
lambda2 = 1.0 / snr ** 2
method = "dSPM" # use dSPM method (could also be MNE or sLORETA)
# Load data
evoked = read_evokeds(fname_evoked, condition=0, baseline=(None, 0))
inverse_operator = read_inverse_operator(fname_inv)
src = inverse_operator['src']
# Compute inverse solution
stc = apply_inverse(evoked, inverse_operator, lambda2, method)
stc.crop(0.0, 0.2)
brain = mne.viz.plot_source_estimates(stc, subject='sample', subjects_dir=data_path / 'subjects', src=src)
Issue Analytics
- State:
- Created a year ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
mne.viz.Brain — MNE 1.2.2 documentation
Specifies how the cortical surface is rendered. Options: The name of one of the preset cortex styles: 'classic' (default), ...
Read more >Support for 3D brain visualization in headless mode?
MNE version: 0.24.0 operating system: Linux on Docker I'm trying to run the MRI reconstruction example without success on a headless installation on...
Read more >Wavelet-based Volume Rendering
The analytic representation of the used B-spline wavelets provides realistic shading effects and analytic error bounds. Finally, by further assuming an ...
Read more >An Overview of Common Data Visualization Mistakes - Toptal
Linking correlation to causation is a data visualization mistake. Data may show correlation, but it doesn't equal causation. 8. Zooming in on Favorable...
Read more >Article - HPC-Forge - Cineca
In-situ visualization allows to couple a simulation with visualization in order to ... volume rendering didn't show any significant scaling after 2 cores....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Agreed, seems like something we can do later
plot_source_estimateshas been around since at least MNE-Python 0.5, i.e., 10 years:https://github.com/mne-tools/mne-python/blob/2de217d600e5b198820adb992d5f1b8bda2b006e/mne/viz.py#L875
And while a lot of these will be false positives, the “2k” count here gives me pause as well:
https://github.com/search?q=plot_source_estimates&type=code
So I’d rather fix than deprecate. Or the easiest route is to just
.. note::after the one-line description of the function that it isn’t guaranteed yet to give the correct output for each input, and thatstc.plotfor surface andstc.plot_3dfor vol source estimates should be preferred for optimal behaviorArgh yes we should fix that bug first. Maybe doing a plot that currently on broken
mainproduces an all black screenshot would be a good way to test, because it’s easy to check in CIs (e.g., that the.mean()of the screenshot is greater than 0.005 for example)