Skip to content

Brain GUI modernization (Phase 7) - #14270

Merged
larsoner merged 5 commits into
mne-tools:mainfrom
payamsash:brain_gui_7
Sep 10, 2026
Merged

larsoner merged 5 commits into
mne-tools:mainfrom
payamsash:brain_gui_7

Conversation

@payamsash

Copy link
Copy Markdown
Member

Reference issue (if any)

Phase 7 of #14042 and following #14222

What does this implement/fix?

Adds possibility to see brain activations in brain labels with different possible modes (e.g. mean-flip)

Additional information

following script is helpful for testing:

import numpy as np
import mne
from mne.datasets import sample

data_path = sample.data_path()
subjects_dir = data_path / "subjects"

# without src, only mean/max are valid
src = mne.setup_source_space(
    "sample", spacing="oct6", subjects_dir=subjects_dir, add_dist=False
)
src_vertices = src[0]["vertno"]

brain = mne.viz.Brain(
    "sample", subjects_dir=subjects_dir, hemi="lh", background="black", show=False
)
coords = brain.geo["lh"].coords


def gaussian_patch(coords, center, sigma=15.0):
    d = np.linalg.norm(coords - center, axis=1)
    return np.exp(-(d**2) / (2 * sigma**2))


times = np.linspace(0, 1, 20)
temporal = gaussian_patch(coords, center=np.array([-52.0, -18.0, -8.0]))[src_vertices]
temporal_t = temporal[:, np.newaxis] * np.exp(3 * times)[np.newaxis, :]
brain.add_data(
    temporal_t,
    hemi="lh",
    vertices=src_vertices,
    src=src,
    fmin=0.1,
    fmax=1.0,
    colormap="hot",
    key="temporal",
    smoothing_steps=5,
    time=times,
    transparent=True,
)

frontal = gaussian_patch(coords, center=np.array([-38.0, 28.0, 46.0]))[src_vertices]
frontal_t = frontal[:, np.newaxis] * (1 - np.exp(-3 * times))[np.newaxis, :]
brain.add_data(
    frontal_t,
    hemi="lh",
    vertices=src_vertices,
    src=src,
    fmin=0.1,
    fmax=0.6,
    colormap="Blues",
    alpha=0.5,
    key="frontal",
    remove_existing=False,
    smoothing_steps=5,
    time=times,
    transparent=True,
)
brain.setup_time_viewer(show_traces=True)
brain.show()


@payamsash
payamsash requested a review from agramfort as a code owner September 4, 2026 05:20
@larsoner

Copy link
Copy Markdown
Member

@wmvanvliet you want to look at this one as well? If not, I can do it

@wmvanvliet

Copy link
Copy Markdown
Contributor

I don't have the bandwidth right now

@larsoner

Copy link
Copy Markdown
Member

Just pushed a couple minor tweaks, marking for merge-when-green, thanks in advance @payamsash !

@larsoner
larsoner enabled auto-merge (squash) September 10, 2026 17:25
@larsoner
larsoner merged commit dbeed03 into mne-tools:main Sep 10, 2026
26 checks passed
larsoner added a commit to drammock/mne-python that referenced this pull request Sep 11, 2026
* upstream/main: (75 commits)
  Brain GUI modernization (Phase 7) (mne-tools#14270)
  Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293)
  remove plotting abs as the defauls for plotting volumetric (mne-tools#13989)
  Coregistration GUI modernisation (phase 4) (mne-tools#14285)
  Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291)
  Width [circle deploy] [skip azp] [skip actions]
  Post-release deprecations (mne-tools#14290)
  FIX: Come on [circle deploy] [skip azp] [skip actions]
  PyVista try again [circle deploy] [skip azp] [skip actions]
  FIX: PyVista [circle deploy] [skip azp] [skip actions]
  FIX: Really [circle deploy] [skip azp] [skip actions]
  FIX: Doc
  Release commit [circle deploy]
  MAINT: Update code credit (mne-tools#14289)
  MAINT: Update pre-commit hook versions (mne-tools#14288)
  BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279)
  Move toward docstacks [circle deploy] [skip azp] [skip actions]
  Fix tfce (mne-tools#14286)
  FIX: Improve channel name rendering in `plot_alignment` (mne-tools#13773)
  Don't shift placeholder proc_history dates in anonymize_info (mne-tools#14248)
  ...

# Conflicts:
#	mne/io/edf/tests/test_edf.py
larsoner added a commit to natinew77-creator/mne-python that referenced this pull request Sep 11, 2026
* upstream/main: (22 commits)
  fix EDF round-trip (mne-tools#14296)
  Brain GUI modernization (Phase 7) (mne-tools#14270)
  Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293)
  remove plotting abs as the defauls for plotting volumetric (mne-tools#13989)
  Coregistration GUI modernisation (phase 4) (mne-tools#14285)
  Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291)
  Width [circle deploy] [skip azp] [skip actions]
  Post-release deprecations (mne-tools#14290)
  FIX: Come on [circle deploy] [skip azp] [skip actions]
  PyVista try again [circle deploy] [skip azp] [skip actions]
  FIX: PyVista [circle deploy] [skip azp] [skip actions]
  FIX: Really [circle deploy] [skip azp] [skip actions]
  FIX: Doc
  Release commit [circle deploy]
  MAINT: Update code credit (mne-tools#14289)
  MAINT: Update pre-commit hook versions (mne-tools#14288)
  BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279)
  Move toward docstacks [circle deploy] [skip azp] [skip actions]
  Fix tfce (mne-tools#14286)
  FIX: Improve channel name rendering in `plot_alignment` (mne-tools#13773)
  ...

# Conflicts:
#	mne/viz/backends/tests/test_renderer.py
larsoner added a commit to natinew77-creator/mne-python that referenced this pull request Sep 11, 2026
* upstream/main: (25 commits)
  ENH: add the JupyterLite notebook setup cell (JupyterLite split 4/5) (mne-tools#14150)
  FIX: Ver [circle deploy] [skip azp] [skip actions]
  Hotfix
  fix EDF round-trip (mne-tools#14296)
  Brain GUI modernization (Phase 7) (mne-tools#14270)
  Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293)
  remove plotting abs as the defauls for plotting volumetric (mne-tools#13989)
  Coregistration GUI modernisation (phase 4) (mne-tools#14285)
  Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291)
  Width [circle deploy] [skip azp] [skip actions]
  Post-release deprecations (mne-tools#14290)
  FIX: Come on [circle deploy] [skip azp] [skip actions]
  PyVista try again [circle deploy] [skip azp] [skip actions]
  FIX: PyVista [circle deploy] [skip azp] [skip actions]
  FIX: Really [circle deploy] [skip azp] [skip actions]
  FIX: Doc
  Release commit [circle deploy]
  MAINT: Update code credit (mne-tools#14289)
  MAINT: Update pre-commit hook versions (mne-tools#14288)
  BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279)
  ...
larsoner added a commit to wmvanvliet/mne-python that referenced this pull request Sep 16, 2026
…d-sphere

* commit '0311e444b0450ce9d2b2b304cebe7d5343533357':
  Fix static doc viewing in IDEs (mne-tools#14195)
  Fix COLA for odd sizes (mne-tools#14312)
  add type hints to mne/_fiff/ module (mne-tools#14278)
  ENH: wire the JupyterLite build into the docs (JupyterLite split 5/5) (mne-tools#14157)
  MAINT: Update pre-commit hook versions (mne-tools#14306)
  Small documentation fix for "Frequency and time-frequency sensor analysis" tutorial (mne-tools#14304)
  FIX: don't mutate cached ICA sources in plot_sources properties (mne-tools#14303)
  Fix bug with lite backend closing (mne-tools#14302)
  Fix for NumPy eig change [circle deploy] (mne-tools#14300)
  No PyQt5 [circle deploy] [skip azp] [skip actions]
  ENH: add the JupyterLite notebook setup cell (JupyterLite split 4/5) (mne-tools#14150)
  FIX: Ver [circle deploy] [skip azp] [skip actions]
  Hotfix
  fix EDF round-trip (mne-tools#14296)
  Brain GUI modernization (Phase 7) (mne-tools#14270)
  Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293)
  remove plotting abs as the defauls for plotting volumetric (mne-tools#13989)
  Coregistration GUI modernisation (phase 4) (mne-tools#14285)
  Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291)
larsoner added a commit to CarinaFo/mne-python that referenced this pull request Sep 16, 2026
* upstream/main: (91 commits)
  Fix static doc viewing in IDEs (mne-tools#14195)
  Fix COLA for odd sizes (mne-tools#14312)
  add type hints to mne/_fiff/ module (mne-tools#14278)
  ENH: wire the JupyterLite build into the docs (JupyterLite split 5/5) (mne-tools#14157)
  MAINT: Update pre-commit hook versions (mne-tools#14306)
  Small documentation fix for "Frequency and time-frequency sensor analysis" tutorial (mne-tools#14304)
  FIX: don't mutate cached ICA sources in plot_sources properties (mne-tools#14303)
  Fix bug with lite backend closing (mne-tools#14302)
  Fix for NumPy eig change [circle deploy] (mne-tools#14300)
  No PyQt5 [circle deploy] [skip azp] [skip actions]
  ENH: add the JupyterLite notebook setup cell (JupyterLite split 4/5) (mne-tools#14150)
  FIX: Ver [circle deploy] [skip azp] [skip actions]
  Hotfix
  fix EDF round-trip (mne-tools#14296)
  Brain GUI modernization (Phase 7) (mne-tools#14270)
  Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293)
  remove plotting abs as the defauls for plotting volumetric (mne-tools#13989)
  Coregistration GUI modernisation (phase 4) (mne-tools#14285)
  Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291)
  Width [circle deploy] [skip azp] [skip actions]
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants