Skip to content

feat(viewer): EGI/BioSemi named-net topomap fallback (nemar-cli#855) - #136

Merged
neuromechanist merged 4 commits into
mainfrom
feature/issue-855-net-montages
Jun 29, 2026
Merged

neuromechanist merged 4 commits into
mainfrom
feature/issue-855-net-montages

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

What

Datasets that ship no electrodes.tsv but use a recognizable EGI geodesic (E1..E128/E256 + Cz) or BioSemi high-density (A1..H32) cap now get an estimated scalp topomap. Previously those labels didn't resolve against STANDARD_1005, so the viewer drew no topo — e.g. HBN OpenNeuro mirrors like on005516, whose source ships no electrode positions (verified: 404 at OpenNeuro), unlike the curated nm000103.

How

  • net-montages.ts — canonical positions for GSN-HydroCel-129, GSN-HydroCel-257, biosemi128, biosemi256, vendored from MNE in the same head/RAS frame as STANDARD_1005, so projectPositions handles them identically.
  • standardMontageFor consults a detected net first (it's authoritative for its own cap: bank labels like C1/F1 also exist in 10-05 but sit elsewhere). BioSemi's A-bank disambiguates the E* label overlap (BioSemi-256 also has E1..E32). Net size is read from the highest bank/number.
  • The caller already flags this layout estimated: true (same as the existing 10-20 fallback), so a measured electrodes.tsv always wins.

biosemi64/32 use standard 10-10 labels, so they already resolved and aren't vendored.

Why this and not import-side synthesis

The OpenNeuro source genuinely lacks electrodes.tsv — the NEMAR import is faithful, nothing was dropped (see nemar-cli#855). Estimating from the named cap fixes the whole class of named-net datasets without mutating any dataset files.

Testing

  • standard-montage.test.ts: 13 tests (EGI 129/257 selection, BioSemi 128/256, A-bank disambiguation, case-insensitivity, standard-set precedence). Validated against real HBN labels (E1..E128 + Cz).
  • Full suite: 621 pass. typecheck clean. biome clean.

Regenerating the vendored tables

import mne
for n in ["GSN-HydroCel-129","GSN-HydroCel-257","biosemi128","biosemi256"]:
    pos = mne.channels.make_standard_montage(n).get_positions()["ch_pos"]
    # label -> [round(x,5), round(y,5), round(z,5)]

Closes nemarOrg/nemar-cli#855.

Two participant-count regressions on /discover:

- Browse range / multi-modality filters were applied to a single
  10-row page while the count + pager used the server total, so
  "min 100 participants" showed "642 datasets, 65 pages" with most
  pages empty. Now fetch the full server-prefiltered set
  (listAllDatasets, paging past the 200 cap), filter as a unit, and
  paginate client-side so the count + pager are honest.

- Search-result cards lost their subject count: hydration via
  /datasets/:id returns participants + latest_version as null, which
  overwrote the search projection's good values. backfillSearchHit
  restores them.

typecheck clean, 615 tests pass.
Replace the dead "Has 10-20 montage" checkbox with a Channels &
montage group: a channel-density dropdown (low/standard/high/
high-density) and an electrode-system dropdown (10-20/10-10/10-05/
BioSemi/EGI geodesic/other). Both are disabled with a "Soon" note
pointing at nemar-cli#854, which adds the n_channels +
electrode_system catalog fields the filter needs.

Drops the now-unused has10_20 FilterState field + has_1020 param.
Datasets that ship no electrodes.tsv but use a recognizable EGI
geodesic (E1..E128/E256 + Cz) or BioSemi high-density (A1..H32) cap
got no scalp topomap, because those labels don't resolve against
STANDARD_1005 (e.g. HBN OpenNeuro mirrors like on005516, whose
source has no electrode positions).

Vendor the canonical positions for GSN-HydroCel-129/257 and
biosemi128/256 from MNE (net-montages.ts, same head frame as
STANDARD_1005) and consult them in standardMontageFor when the cap
is detected. The net is authoritative for its own cap (some bank
labels like C1/F1 also exist in 10-05 but sit elsewhere), and
BioSemi's A-bank disambiguates the E* label overlap. Result is
flagged estimated by the caller, like the existing 10-20 fallback.

Closes nemarOrg/nemar-cli#855.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: adba084
Status: ✅  Deploy successful!
Preview URL: https://d531aae5.nemar-website.pages.dev
Branch Preview URL: https://feature-issue-855-net-montag.nemar-website.pages.dev

View logs

The BioSemi A-bank probe tripped on a plain 10-20 montage: the A2
ear reference matches /^A\d/ and F3/F4/C3/C4 match [A-H]\d, so a
standard cap with an A1/A2 ref was projected onto a BioSemi head.
Require the bank labels to be a majority (>=60%) of the channels --
a real BioSemi cap is almost all A1..H32, a 10-20 only a few. Falls
through to STANDARD_1005 otherwise. Regression test from nm000109.
@neuromechanist
neuromechanist merged commit 7368a64 into main Jun 29, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-855-net-montages branch September 30, 2026 19:25
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.

OpenNeuro (on*) mirrors miss electrodes.tsv/coordsystem, breaking the scalp topomap

1 participant