Skip to content

feat: vendor MNI152 template brain surface (IS-T1) - #551

Merged
neuromechanist merged 9 commits into
feature/issue-537-epic-spatialfrom
feat/is-t1-template
Nov 18, 2026
Merged

neuromechanist merged 9 commits into
feature/issue-537-epic-spatialfrom
feat/is-t1-template

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Card IS-T1 of the iEEG spatial view plan. Part of #537.

What changed

  • scripts/vendor-brain-template.py: a uv script (PEP 723, exact pins, exclude-newer) that downloads the TemplateFlow MNI152NLin2009cAsym gray and white matter probability maps and the MNI LICENSE, checks each against a SHA-256 written in the script, and builds the surface (sum, 0.5 isosurface at 1 mm, cut at x = 0, largest piece per hemisphere, Taubin smoothing x10, quadric decimation to at most 15,000 vertices) in brain-mesh v1.
  • public/vendor/brain-templates/mni152nlin2009casym@1/: lh.mesh.bin, rh.mesh.bin, views.json (left, top, front outlines), LICENSE.txt (the MNI notice verbatim plus one line naming this surface), provenance.json, SHA256SUMS, README.md.
  • test/brain-template-vendor.test.ts: checksum and file-set check, script hash in provenance, license verbatim, header and vertex budget, five landmark checks, winding, size budget, views, and a known-answer check that the Python writer and the TypeScript encoder produce the same bytes.

No CSP or _headers change: the default static-asset revalidation by ETag is what the plan asks for.

Gates run

  • bun run test test/brain-template-vendor.test.ts: 26 passed.
  • bun run typecheck: 0 errors. bun run lint: no fixes applied. biome check on the new test file: clean.
  • uvx ruff check --isolated scripts/vendor-brain-template.py: all checks passed.
  • Reproducibility: two runs into separate empty directories (one from another working directory) gave identical SHA256SUMS; a third run into the committed folder matched.
  • Leak check on README.md, provenance.json and LICENSE.txt: prints nothing.
  • Measured: lh.mesh.bin 266,170 bytes (14,955 vertices), rh.mesh.bin 266,092 bytes (14,942 vertices), views.json 4,131 bytes, folder total 542,607 bytes.

Review round 1 (Sonnet, project:pr-review-toolkit): dispositions

  • Fixed: rebuild command now rewrites the default folder; tight midline test; exact source-pin match; license addendum names the template; views.json documents the even-odd rule.
  • Fixed (coordinator round): provenance.json records the resolved environment (five pinned packages and every transitive package, by walking Requires-Dist), pinned by a test; README, provenance and test comments state the surface scope accurately (cerebrum and cerebellum tissue surface, not a pial surface); winding threshold raised to 0.78 and a signed-volume check added (positive, 0.7 to 1.1 million cubic millimeters).
  • Not acting, intentional: intermediate commits are not individually green (a squash merge makes it moot); the known-answer pin is one-directional (documented and accepted, since CI has no Python).
  • Epic tip f5fe03a merged into this branch.

Not run

  • CI on the final head: not run, would check every job green via gh pr checks.

Card: IS-T1.

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: d812db7
Status: ✅  Deploy successful!
Preview URL: https://c27b5dac.nemar-website.pages.dev
Branch Preview URL: https://feat-is-t1-template.nemar-website.pages.dev

View logs

@neuromechanist
neuromechanist merged commit 4392b32 into feature/issue-537-epic-spatial Nov 18, 2026
5 checks passed
@neuromechanist
neuromechanist deleted the feat/is-t1-template branch November 18, 2026 00:44
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