Repository navigation
feat(viewer): standard-montage topomap fallback - #118
Merged
Merged
Conversation
Most EEG datasets name standard 10-20/10-10 channel labels but ship no electrodes.tsv, so their Zarr store carries no coordinates and the scalp topomap stayed disabled (e.g. on007137). Add a viewer-side fallback: when a recording has no embedded positions, project a vendored standard_1005 montage (MNE make_standard_montage, head/RAS frame) matched to the EEG channel labels, exactly as EEGLAB/MNE do when you apply a named montage. Real electrodes.tsv positions still take precedence; the toggle tooltip flags an estimated layout. This covers existing AND future datasets with no backfill or re-conversion, and self-gates: non-standard label sets (EGI E1.., BioSemi A1.., numeric) resolve fewer than 3 channels and get no topomap rather than a wrong one. Legacy 10-20 names (T3/T4/T5/T6) alias to their modern 10-10 equivalents; matching is case-insensitive so FP1 resolves to Fp1. - standard-montage.ts: vendored 343-label montage + lookup/standardMontageFor - viewer.ts: resolveScalpPositions() drives all three topo gates - standard-montage.test.ts: lookup, aliases, case, self-gating
Deploying nemar-website with
|
| Latest commit: |
dc83001
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fe01334a.nemar-website.pages.dev |
| Branch Preview URL: | https://feat-topo-standard-montage-f.nemar-website.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Most EEG datasets name standard 10-20/10-10 channel labels but ship no
electrodes.tsv. Their Zarr store therefore carries no electrode coordinates, so the scalp topomap stayed permanently disabled. Concrete example: on007137 (channelsFP1, Fz, F3, FC3, CPz, PO3, ..., noelectrodes.tsv) showed no topo. This is the majority case, not a backfill gap.Fix
Viewer-side fallback. When a recording has no embedded positions, project a vendored standard_1005 montage (from MNE
make_standard_montage, head/RAS frame, 343 labels) matched to the EEG channel labels by name, exactly as EEGLAB/MNE do when you apply a named montage. Realelectrodes.tsvpositions (embedded by the converter) always take precedence; the topo toggle tooltip flags when the layout is estimated rather than measured.Why viewer-side
Self-gating (no wrong topomaps)
E1..E128), BioSemi (A1..-> only ear refsA1/A2match = 2 < 3), purely numeric.T3/T4/T5/T6) alias to modernT7/T8/P7/P8; matching is case-insensitive (FP1->Fp1).Changes
standard-montage.ts(new) - vendored montage +lookupStandardPosition/standardMontageFor.viewer.ts-resolveScalpPositions()drives all three topo gates (build, group-switch enable, toolbar button).standard-montage.test.ts(new) - lookup, aliases, case-insensitivity, self-gating, on007137-style labels.Validation
astro check0 errors; biome clean.standard_1005, 343 labels, MRI/RAS metres).