Skip to content

feat(migrate): the missing lookup tables, from their upstream sources (T02) - #24

Merged
oesteban merged 1 commit into
masterfrom
feat/migrate-sources
Dec 5, 2026
Merged

oesteban merged 1 commit into
masterfrom
feat/migrate-sources

Conversation

@oesteban

@oesteban oesteban commented Dec 5, 2026

Copy link
Copy Markdown
Member

Summary

PR 5b2 of the migration to TemplateFlow 2.0: the 54 segmentations without a lookup table get one, and the MNI152NLin6Asym Harvard-Oxford tables are rebuilt. Each table is committed under migrate/config/tables/, and its tables.sources entry cites the upstream file (URL, version, sha256) and how the table was written from it. Stacked on #23.

 plan_tables                      # migrate/lookups.py
-  T01 every table (layouts or format only)
+  T01 every table but those a source replaces
   T02 tables.sources             # 24 entries (was 0)
+      skipped when the table already has the source's bytes (planning a migrated tree)
   T03 participants
 check_labels
 tfmanager/migrate/config/
 ├── 2.0.0.yaml                   # + tables.sources (24), + rename tissues-WHS,
 │                                # - layout FSL-Harvard-Oxford-xyz (its tables are replaced)
+└── tables/                      # 24 TSVs, shipped in the wheel
Template Tables Written from
MNI152NLin6Asym HOCPAL, HOCPA, HOSPA dseg (replaced) and probseg (new), with xyz FSL's Harvard-Oxford XML: data_atlases tag 2103.0; the lateralized one from FSL 5's atlases as nilearn fetches them (NITRC). Index = FSL index + 1, the value of FSL's maxprob images, to which the dseg images are voxel-identical
MNI152NLin6Asym HCP HCP Pipelines v6.0.0 FreeSurferSubcorticalLabelTableLut.txt
MNI152NLin2009cAsym HOCPAL, HOCPA, HOSPA (no xyz) the same XML files; centroids within 2.7 mm of 6Asym's
MNI152NLin2009cAsym seg-aseg dseg and probseg, DKT31 FreeSurfer 7.4.1 FreeSurferColorLUT.txt; DKT31's 91, 92, 630 to 632 named from Mindboggle's labels.py
MNI152NLin2009cAsym, SUIT MIAL67ThalamicNuclei and Diedrichsen2009 probseg the template's dseg table, whose order the volumes follow (checked on the data)
MouseIn CCFv3 the authors' table on OSF (szyqe)
UNCInfant AAL; desc-cerebrum the release document's Table 2; the data (10 CSF, 150 GM, 250 WM)
WHS Osen2019 (v3); desc-cerebrum; desc-tissues the v3 ITK-SNAP label file, 44 "inner ear" from v2's; the data
Fischer344, NMT31Sym, RESILIENT desc-tissues the papers (class order) and the data
  • 4D probseg order: where no upstream states it, the order is read from the data. Volume k puts its probability mass on one dseg label, and that label has its highest mean probability in volume k. The aseg probseg table carries the FreeSurfer value of each volume in a described freesurfer_label column.
  • Tissue maps get abbreviation and the BIDS 1.11.0 mapping where a class is a common label, n/a otherwise (NMT's blood vasculature, Fischer344's "other").
  • WHS: tpl-WHS_res-2_atlas-v3_dseg.nii.gz is not the v3 atlas but the GM/WM/CSF tissue image RESILIENT was built with. It becomes tpl-WHS_res-2_desc-tissues_dseg.nii.gz (rename tissues-WHS; the golden renames change by that one row).

Evidence

Planning the whole Archive from the pinned v2 skeleton (test_archive):

Before After
Transforms T01 140, T03 4 T01 137, T02 31 (24 tables, 7 sidecars), T03 4
Findings M201 24, M202 54, M205 30, M206 6, M207 6, M208 6, M210 2 M201 24, M205 30, M207 6, M208 6, M210 2
Blocked tpl-MNI152NLin6Asym none

Every table passes the label check against its images: no value without a row, no new row that labels nothing, and probseg rows equal to volumes 1 to N in every resolution.

Notes for the WP5 template PRs:

  • MNI152NLin6Asym HOCPAL and HOCPA probseg (res-1 and res-2) are all zeros. Their tables are written now; the template's WP5 PR replaces the data with FSL's 4D images.
  • UNCInfant desc-cerebrum 10 reads as CSF in cohorts 2 and 3, and closer to GM in the neonates (the class that is neither GM nor WM).
  • WHS 44 (165 voxels, also in the official v3 image) is "inner ear" after v2's label file; v3 and v4 do not list it.

Tests:

  • test_sources: a replaced table needs no layout; planning the result again writes nothing and finds nothing, whatever replace says.
  • test_bundled_sources: each TSV under tables/ belongs to exactly one source.
  • test_archive, test_archive_rules and the golden renames are updated. Planning the migrated Archive again is still idempotent.
  • Local mirror of CI at 6b04d42: 341 passed on 3.13 and 3.15, ruff clean; sdist and wheel pass twine check, and the wheel ships the 24 tables.

Closes templateflow/templateflow#203.

Merge Danger

Door: two-way

Config, package data and a small engine change; nothing in the Archive changes until a template's WP5 PR applies its plan.

Blast Radius: MNI152NLin6Asym

  • Once applied, the three MNI152NLin6Asym HO dseg tables change in place for every client (decision 1: same name). HOCPAL's index moves from FSL's 0-based numbers to the image values (+1), which fixes lookups that were off by one. HOSPA loses its Background row and takes FSL's names. HOCPA gains xyz.
  • WHS's res-2 image is renamed: its old key keeps serving it through a rename row.

… (T02)

The 54 segmentations of the Archive without a lookup table get one, and
the MNI152NLin6Asym Harvard-Oxford tables are rebuilt (HOCPAL had FSL's
0-based index and 52 of 96 rows). 24 tables under migrate/config/tables/,
each with a tables.sources entry that cites the upstream file (URL,
version, sha256) and says how the table was written from it: FSL's
Harvard-Oxford XML files, FreeSurfer 7.4.1's color table (aseg, DKT31,
with Mindboggle's names for 91, 92 and 630 to 632), HCP Pipelines'
subcortical table, the MouseIn authors' table on OSF, the UNC infant
atlases' release document (AAL), and the Waxholm Space v3 label file
(44 named from v2). The order of 4D probseg volumes (aseg, MIAL67,
SUIT) and the tissue maps (Fischer344, NMT31Sym, RESILIENT, UNCInfant,
WHS) are checked against the data and their papers.

WHS's res-2 atlas-v3 image is RESILIENT's tissue image, not the atlas:
it becomes desc-tissues. A table a source replaces is no longer
converted first (the FSL layout goes), and planning a migrated template
writes no source table again.

On the Archive, nothing is blocked any more; M202, M206, TF401 and TF407
are gone (260 to 206 strict errors).

Closes templateflow/templateflow#203.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from feat/migrate-tables to master December 5, 2026 06:13
@oesteban
oesteban marked this pull request as ready for review December 5, 2026 06:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T06:18:12.940501Z 6b04d42 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@oesteban
oesteban merged commit 1ac6919 into master Dec 5, 2026
@oesteban
oesteban deleted the feat/migrate-sources branch December 5, 2026 06:20
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.

Missing label lookup tables (dseg TSV) for several atlases and segmentations

1 participant