Skip to content

Brain GUI modernization (Phase 5) - #14149

Open
payamsash wants to merge 4 commits into
mne-tools:mainfrom
payamsash:enh/brain-gui-phase5-tracelist
Open

Brain GUI modernization (Phase 5)#14149
payamsash wants to merge 4 commits into
mne-tools:mainfrom
payamsash:enh/brain-gui-phase5-tracelist

Conversation

@payamsash

Copy link
Copy Markdown
Member

Reference issue (if any)

Phase 5 of #14042 and following #14102

What does this implement/fix?

  • Adds a "Trace List" dock
  • Styling ppolish for the traces and remove the legend (but kept for Jupyter)
  • visibility change for the traces and their correspondence 3D glyph
  • renamed "Trace" to "Atlas"

Additional information

Docs for the functions are written by Claude. Also test is written by Claude, but I made it minimal and faster.

@payamsash payamsash changed the title modify trace in brain gui Brain GUI modernization (Phase 5) Aug 11, 2026
@payamsash
payamsash requested a review from agramfort as a code owner August 11, 2026 09:35
@payamsash
payamsash force-pushed the enh/brain-gui-phase5-tracelist branch from a1516a7 to c44b9e4 Compare August 11, 2026 09:39
@larsoner

Copy link
Copy Markdown
Member

@wmvanvliet do you have time to look? If not, I can

@wmvanvliet

Copy link
Copy Markdown
Contributor

I love the trace list! I would love it even more if you could name the traces.

Why did you remove the legend though? That was a useful feature and I don't remember us discussing its removal.
The traces now look too thick on my 1080p screen. I liked them better before. The sizing of the matplotlib figure is much improved.

"Set Atlas to None to see vertex and RMS traces here." <-- a bit weird message I think, because the traces work fine with an atlas selected.

@wmvanvliet

Copy link
Copy Markdown
Contributor

if the new trace list is meant to replace the old legend, then the vertex numbers and MNI coordinates need to be there.

@wmvanvliet

Copy link
Copy Markdown
Contributor

The text size of the trace list is a bit bigger than the size of the other text labels. It's probably better if they were the same size.

@payamsash

payamsash commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

I love the trace list! I would love it even more if you could name the traces.

Do you mean user-editable names? If you add key in brain.add_data, the key will be the trace name.

Why did you remove the legend though? That was a useful feature and I don't remember us discussing its removal.

It was too small text for me, also when moving the time (dashed line) it jumps to left and right, but it's easy to return it (_legend_in_figure = True), wdyt?

The traces now look too thick on my 1080p screen. I liked them better before.

agree, I will go for lw=1.8 now its 2.4

"Set Atlas to None to see vertex and RMS traces here." <-- a bit weird message I think, because the traces work fine with an atlas selected.

I see, it should be "annotations" not "atlas" in the txt, becasue when you select an annotation, traces will be gone.

if the new trace list is meant to replace the old legend, then the vertex numbers and MNI coordinates need to be there.

agree

The text size of the trace list is a bit bigger than the size of the other text labels. It's probably better if they were the same size.

agree.

P.S. I know my eyesight isn't very good :)

@payamsash

Copy link
Copy Markdown
Member Author

I use this short script for testing, I thought maybe it could be also useful for you for testing (also for next phases) @wmvanvliet

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

data_path = sample.data_path()
subjects_dir = data_path / "subjects"
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)
vertices = np.arange(len(coords))
temporal = gaussian_patch(coords, center=np.array([-52.0, -18.0, -8.0]))
temporal_t = temporal[:, np.newaxis] * np.exp(3 * times)[np.newaxis, :]
brain.add_data(
    temporal_t,
    hemi="lh",
    vertices=vertices,
    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]))
frontal_t = frontal[:, np.newaxis] * (1 - np.exp(-3 * times))[np.newaxis, :]
brain.add_data(
    frontal_t,
    hemi="lh",
    vertices=vertices,
    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)

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