Skip to content

Brain panel: this subject's anatomy - #568

Merged
neuromechanist merged 7 commits into
stagingfrom
feat/ieeg-subject-anatomy
Nov 19, 2026
Merged

neuromechanist merged 7 commits into
stagingfrom
feat/ieeg-subject-anatomy

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

When a dataset's NEMAR geometry index has a verified surface for the electrodes file the Brain panel shows, the Frame selector offers "This subject's anatomy" (the default for that file) and draws the subject's own cortical surface under the contacts, in the contacts' own frame, never mixed with the template. Website ADR 0034 (proposed) records the decision and resolves ADR 0033's open item.

  • New subject-anatomy.ts: strict index validation (schema, version, hemisphere keys, content address, fit), entry match on the dataset-relative electrodes path, mesh fetch with byte count and SHA-256 checked before decoding, label and notes, and a silhouette outline computed from the subject mesh for the 2D views and SVG.
  • Panel: one request for <zarr host>/<dataset>/zarr/geometry/index.json per dataset, only while the panel is open (404 means no subject anatomy). Any failed check hides the option with one console warning.
  • Label "This subject's anatomy, from the dataset's own surfaces" plus "approximate alignment (depth contacts)" for plausible fits; notes cite the source surfaces and name a single hemisphere; exports carry the same words.

Evidence

  • bun run lint: clean. bun run typecheck: 0 errors, 0 warnings.
  • bunx vitest run src/lib/ieeg-spatial: 18 files, 606 tests passed (new: subject-anatomy.test.ts, a "subject anatomy" block in panel.test.ts, entry match, validation of bad hash, version and hemisphere key, labels per grade, one-hemisphere notes, no index request while closed, no mixing with a template row).
  • e2e/ieeg-subject-anatomy.spec.ts against the local dev server (port 4410), 3 passed: on004473 with the committed fixture served for zarr.nemar.org/on004473/zarr/geometry/**; asserts no request while closed, exactly one index.json and two meshes after opening, the selected option and exact label, "Subject surfaces:" note and no "No brain surface", three outline paths in the 2D views, a 404 index leaves no option, and a dark-mode run.
  • Screenshots (light and dark, 3D and 2D) were reviewed locally; they are not committed.
  • Fixture: real pipeline output for on004473 sub-1 (both hemispheres, ACPC, plausible), decimated to 12,000 vertices, 215 KB per hemisphere.
  • Not run: the full bun test or vitest suite outside src/lib/ieeg-spatial, and a deployed site.

Round 1 review fixes

  • Subject surface drawn as one front shell (back faces culled) at half alpha; the e2e counts amber contact pixels (light 699, dark 379; the first version measured 332 and 110, and the spec asserts above 500 and 250).
  • Frame option reads "Subject anatomy"; the select is capped and the view controls stay on its row (asserted by bounding box).
  • The first surface waits for the index (at most 2 s) so the template never flashes; integrity failures are permanent, transport failures retried; reads are size-capped; anatomy choice resets per recording; ADR 0034 states how 403 and 404 are treated.
  • The e2e serves the geometry host from committed real pipeline output until card P3 uploads it; the spec must be re-pointed at the real host then.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 15a98fe
Status: ✅  Deploy successful!
Preview URL: https://b574e20b.nemar-website.pages.dev
Branch Preview URL: https://feat-ieeg-subject-anatomy.nemar-website.pages.dev

View logs

@neuromechanist
neuromechanist merged commit 320b60d into staging Nov 19, 2026
4 checks passed
@neuromechanist
neuromechanist deleted the feat/ieeg-subject-anatomy branch November 19, 2026 20:26
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.

1 participant