Skip to content

ENH: Reapir and enahnce logic of ChannelsSelect event handling in Xfit-like dipole GUI - #25

Merged
wmvanvliet merged 6 commits into
wmvanvliet:xfitfrom
Gnefil:xfit-channel-select
Aug 21, 2026
Merged

ENH: Reapir and enahnce logic of ChannelsSelect event handling in Xfit-like dipole GUI#25
wmvanvliet merged 6 commits into
wmvanvliet:xfitfrom
Gnefil:xfit-channel-select

Conversation

@Gnefil

@Gnefil Gnefil commented Aug 13, 2026

Copy link
Copy Markdown

Reference issue (if any)

What does this implement/fix?

The channel select function suffered deterioration due to a recent rendering pipeline upgrade, for the sake of efficiency. It wasn't able to properly highlight the selected channels in the GUI.

This PR repairs the issue by changing the colour of the cloud specific to each actor, while also improving the logic to extend to all channel types and coils.

Additional information

@wmvanvliet

Copy link
Copy Markdown
Owner

oh, field_data is a nice find and very elegant.

@Gnefil
Gnefil marked this pull request as ready for review August 17, 2026 22:00
Copilot AI lite review requested due to automatic review settings August 17, 2026 22:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the dipole fitting GUI’s 3D sensor rendering/selection path so selected channels can be highlighted reliably after the instanced-rendering changes, by attaching channel-name metadata to the underlying glyph “cloud” datasets and driving selection highlighting via per-point RGBA updates. It also adds a GUI test assertion that the 3D selection state matches the topo lasso selection.

Changes:

  • Make _plot_glyphs() return both the VTK actor and the underlying point “cloud” dataset, enabling later per-point updates.
  • Attach ch_names into cloud.field_data for instanced sensor meshes to support mapping selections back to channel names.
  • Update the dipolefit GUI + tests to recolor sensors based on selected channel names and validate the highlight behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
mne/viz/_3d.py Returns glyph cloud objects and stores per-instance ch_names metadata on sensor glyph clouds for selection/highlighting.
mne/gui/_dipolefit.py Switches sensor selection highlighting to operate on per-point RGBA in the instanced glyph “cloud” data.
mne/gui/tests/test_dipolefit.py Adds assertions that selected channels are actually highlighted in the 3D sensor scene and cleared on close.
Suppressed comments (1)

mne/viz/_3d.py:1516

  • Indexing [0] on _plot_glyphs(...) will raise when there are no head-shape ("extra") dig points (because _plot_glyphs returns None when len(loc) == 0). This makes _plot_head_shape_points fail for infos without FIFFV_POINT_EXTRA.
        backface_culling=True,
        check_inside=check_inside,
        nearest=nearest,
    )[0]

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread mne/viz/_3d.py
Comment thread mne/viz/_3d.py
Comment thread mne/gui/_dipolefit.py Outdated
Comment thread mne/gui/_dipolefit.py Outdated
Comment thread mne/gui/_dipolefit.py
@Gnefil Gnefil changed the title ENH: Reapir and enahnce logic of channel selection in Xfit-like dipole GUI ENH: Reapir and enahnce logic of ChannelsSelect event handling in Xfit-like dipole GUI Aug 18, 2026
@wmvanvliet

Copy link
Copy Markdown
Owner

I'll merge this in and then continue work in the xfit branch myself. Thanks for your help @Gnefil!

@wmvanvliet wmvanvliet closed this Aug 21, 2026
@wmvanvliet wmvanvliet reopened this Aug 21, 2026
@wmvanvliet
wmvanvliet merged commit 6be5736 into wmvanvliet:xfit Aug 21, 2026
1 check passed
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