# Model card: Striatum hand atlas v1

Automatic ROI placement in Striatum Quant (`assets/apps/striatum-atlas.js`, data `assets/models/striatum-hand-atlas-v1.js`).
Validation numbers: `striatumHandAtlas-v1.validation.json`. A readable summary for reviewers: `striatum-validation.html` (the
"Validation" link in Striatum Quant's header).

## What it does
Places the six Striatum Quant ROIs (DV, ML and MV-DL arrows, three noise boxes) by carrying them over from the
most similar of 249 sections whose ROIs were placed by hand. There are no anatomy rules: where the arrows start
and end is whatever the hand placements did on the closest sections.

1. The section (the anatomy/reference channel) is resampled to 80 µm per pixel using the file's pixel size and
   contrast-normalized (5th to 99.5th percentile). Tissue is everything brighter than a quarter of the Otsu level
   (the largest piece and any piece at least 15% of its size). Images without a pixel size are scaled so their tissue
   area matches the library's median section.
2. Matching uses 35% normalized intensity and 65% local contrast (each pixel against its 0.3 mm surroundings).
   Intensity alone failed on DAT-cre cKO sections, whose striatum is no brighter than cortex; local contrast keeps the
   corpus callosum, ventricles, fibre bundles and outline.
3. Each library section (and its mirror image, for the other hemisphere) is located by masked normalized
   cross-correlation at 320 µm/px; the 24 best are aligned by ECC (shift, rotation, scale) at 160 then 80 µm/px.
   Alignments that run away (scale outside 0.7–1.4, a turn over 30°) are dropped, and so are matches that would
   carry the arrows across the section's midline (its axis of mirror symmetry; the axis must pair at least 70% of
   the tissue with tissue).
   Each alignment is then refit by ECC over the match's striatum and 640 µm around it alone; the arrows follow the
   refit when it stays within 20% of the scale, 12° of the turn and 640 µm of the whole-section fit. This keeps
   sections whose outline differs from the library's (another lab's cut, a figure split at the midline) on target.
4. The 8 best-correlated carry their arrows over; each endpoint is the weighted median (weight correlation⁴).
5. Noise boxes: each library section records how bright its hand noise boxes were against its own tissue outside the
   striatum (0.97 typically, IQR 0.90–1.08). The matches' weighted median of that ratio, applied to the new section,
   is the level aimed for. Candidates (the matches' own boxes and a grid of boxes of their typical size) must lie
   wholly in tissue and clear of both striata (the arrows' extent on either side, grown by 320 µm); the three chosen,
   not overlapping, are those whose background is closest to that level (|log ratio|), with a pull of 0.03 per 80 µm
   towards where the matches put their boxes.
6. Four arrow ends sit on the striatum's edge in the hand placements (the steepest outward drop in TH lies within
   120 µm of the hand end for 95% of DV starts, 78% of ML starts, 86% of ML ends and 95% of MV-DL ends; the DV end
   and MV-DL start do not follow an edge). Each of those four moves along its arrow to the steepest drop near it, as
   far as 800 µm outward for the DV start and the dorsolateral corner (a rostral striatum reaches higher than its
   matches), 480 µm for the ML ends; the drop is measured as means over 200 µm a side for the far-reaching two, so
   a fibre bundle does not pass for the corpus callosum.
7. Both sides are always solved. The section's mirror map comes from aligning it with its own mirror image (ECC).
   A side whose striatum is paler than the other along the arrows and whose matches fit worse (a lesion, a one-sided
   knockout) takes the other side's arrows, mirrored: evidence z = (1 − own/other TH) / 0.15 + (other − own refit
   correlation) / 0.06, none below 2.5, fully from 3.5. The Auto ROI status says when this happened.
8. Arrow ends that fall off the section are drawn back along the arrow to its edge.
9. Hemisphere "Auto": the side whose placement is expected to be the more accurate. Expected mean endpoint error:
   log(µm) = 6.016 − 1.721 × (mean correlation of the 8 matches) + 0.0909 × (their spread about the median, 80 µm px),
   fitted to the held-out placements (rank correlation with the actual error 0.46; the correlation alone 0.40). The
   other side's placement is drawn faintly with its expected error, one click (or F) away.

Match quality shown in the Auto ROI pill: high (mean correlation ≥ 0.65), medium (≥ 0.55), low.

## Library
- 249 TH-stained coronal sections from 20 animals: Crhr1-Cre (8), DAT-Cre (5), Ntsr1-Cre (6) and Calb1-Cre (1)
  × FloxTH, cKO and control (cre- or f.wt).
  - 204 whole sections, 10x MaxIP ND2 (2.49 or 2.52 µm/px), single far-red TH channel.
  - 45 sections cropped around the striata, 3-channel ND2 (DAPI, FITC/DAT, CY3/TH; 1.235 µm/px); TH (CY3) is used.
- ROIs: one person's Fiji ROI sets (Striatum Analysis & Quantification, 9-23-26); 327 sets, of which the 249 whose
  image could be found by file name are used. Most Calb1-Cre animals (914–917) are not in the library because their
  images were not available.
- Stored per section: the 80 µm/px normalized image (uint8), the three arrows and three boxes in those pixels, the
  quantified side, the t.N section number and an animal tag (used only to hold animals out in validation).

## Validation
Leave-one-animal-out: every section was placed using only the other 19 animals' sections. Distances are from the hand
placement, per arrow endpoint, with the hand-chosen hemisphere.

| Metric | Hand atlas v1 | Previous rule engine |
|---|---|---|
| Median endpoint error, all 249 | 137 µm | — |
| Mean endpoint error, all 249 | 181 µm | — |
| Median endpoint error, 204 whole 10x sections | 129 µm | 373 µm |
| Endpoints more than 500 µm off, whole sections | 3.2% | 37.1% |
| Median endpoint error, 45 cropped 3-channel sections | 166 µm | — |
| Endpoints more than 500 µm off, cropped sections | 10.7% | — |
| Worst whole section (mean of its 6 endpoints) | 844 µm | — |
| Worst section overall | 1171 µm | — |
| Hemisphere "Auto" agrees with the hand choice | 152/249 (61%) | 119/204 (58%) |
| Noise-box background / hand noise-box background | 0.99 (IQR 0.90–1.08) | 1.12 |
| Time per section (both hemispheres, Node, 8 at once) | 2.1 s | — |

Without edge snapping (v2.15): median 141 µm, mean 182 µm, 4.4% over 500 µm; snapping brings the DV start from
95 to 90 µm and the ML end from 146 to 137 µm. Before the striatum refit, the midline rule and mirroring (v1 as
first built): median 145 µm, mean 192 µm, worst
section 3092 µm (a cropped section put on the wrong striatum by a midline found a quarter of the way across; 35
library sections had such a midline).

For scale: the hand-drawn DV arrow is about 3.0 mm long, ML 2.1 mm, MV-DL 2.7 mm.

Per endpoint, median (90th percentile), all 249: DV start 90 (201), DV end 190 (416), ML start 121 (494), ML end 137
(339), MV-DL start 183 (384), MV-DL end 122 (313) µm.

Mean endpoint error by group: Crhr1 cKO 170, Crhr1 control 126, DAT cKO 211, DAT control 198, Ntsr1 cKO 247,
Ntsr1 control 159 µm. Calb1 (2 sections, one animal, so none left to match when it is held out): 388 µm.

Published sections (outside the library's domain): 11 DAB-stained coronal sections from three open-access papers
(Sci Rep 2024; Front Pharmacol 2022; Front Aging Neurosci 2026, the last shown as two half-sections), inverted to look
like fluorescence and judged by eye, both hemispheres each. v1 as first built placed 11 of 22 sides well; with
the striatum refit and mirroring (v2.15), 17 of 22; with edge snapping (v2.16) the placements were judged ready to
publish. The five left at v2.15: a rostral section (both sides; the matches'
striatum is smaller, which edge snapping addresses), a caudal one (both sides; the ventral ends run below the
smaller caudal striatum) and one heavily damaged side.

The rule engine was run on the 204 whole sections (4× downsampled display, the same auto-contrast), with the
hemisphere given and on Auto.

## Effect on measurements
What the analysis reports matters more than where the arrows land. All 249 sections were measured at full resolution
with the hand ROIs and with the held-out auto ROIs (the placement validation above), both at line width 2 as in Fiji,
and both sets went through Striatum Quant's own profile analysis (`assets/apps/striatum-profile-core.js`,
"r-workflow": profile minus the section's mean noise, 30 bins, divided by the maximum of the mean control curve of
the same strain, staining round and arrow; a round without controls of its strain uses that strain's controls from
all rounds, as for 18 knockout sections here). Re-measuring the hand ROIs reproduced the original Fiji CSVs to within
2e-05 of a normalized unit, so the comparison isolates ROI placement. Units: normalized fluorescence, control
curve maximum = 1 (controls run at about 0.7–0.8).

Group results, control minus cKO averaged over the 30 bins (bins with p < 0.05, Welch's t-test per bin):

| Strain, arrow | Control / cKO | Hand ROIs | Auto ROIs, hand hemisphere | Auto ROIs, Auto hemisphere |
|---|---|---|---|---|
| Crhr1 DV | 71 / 41 | 0.72 (30/30) | 0.74 (30/30) | 0.74 (30/30) |
| Crhr1 ML | 71 / 41 | 0.62 (30/30) | 0.72 (30/30) | 0.72 (30/30) |
| Crhr1 MV-DL | 71 / 41 | 0.72 (30/30) | 0.76 (30/30) | 0.73 (30/30) |
| Dat DV | 23 / 42 | 0.75 (30/30) | 0.72 (30/30) | 0.75 (30/30) |
| Dat ML | 23 / 42 | 0.63 (30/30) | 0.66 (30/30) | 0.67 (30/30) |
| Dat MV-DL | 23 / 42 | 0.76 (30/30) | 0.71 (30/30) | 0.72 (30/30) |
| Ntsr1 DV | 25 / 45 | 0.61 (30/30) | 0.48 (30/30) | 0.40 (30/30) |
| Ntsr1 ML | 25 / 45 | 0.38 (27/30) | 0.49 (30/30) | 0.40 (30/30) |
| Ntsr1 MV-DL | 25 / 45 | 0.69 (30/30) | 0.60 (30/30) | 0.47 (30/30) |

Every control–cKO difference found with the hand ROIs is also found with the auto ROIs, significant in as many bins
or more (Ntsr1 ML: 27 of 30 bins by hand, 30 with auto). Effect sizes agree within 0.10 for Crhr1 and Dat. Ntsr1
differs more: DV and MV-DL differences are smaller with auto ROIs (DV 0.61 by hand, 0.48 auto, 0.40 with Auto's
hemisphere) because they read more residual TH in the cKOs, while ML is larger (0.38 by hand, 0.49 auto).

Per section and arrow, the auto ROIs' whole-arrow mean is within 0.046 of the hand value (median; 90th
percentile 0.23; bias +0.034); with Auto's hemisphere, 0.057 (0.31). The 30-bin shape of a
single section does not reproduce (median correlation 0.51): moving an arrow ~140 µm crosses different TH
patches. Group curves average this out (`training/striatumHandAtlas-v1/figures/measurement_hand_vs_auto.png`).

The noise boxes and the arrows contribute about equally: auto arrows with the hand boxes are within 0.024
(0.13), hand arrows with the auto boxes within 0.031 (0.17). Auto noise is 0.99 of the hand noise
(IQR 0.90–1.07) overall, but 0.79 in the Ntsr1 cKOs, where the hand boxes sit on brighter tissue than in any
other group (1.28 times the tissue outside the striatum, against 0.97 typically); averaged over the three arrows,
Ntsr1 cKOs read 0.23 with the auto ROIs, 0.11 with the auto arrows and the hand boxes, and 0.13 by hand.

Before the noise boxes aimed at the matches' level (v2.17), the per-arrow agreement was 0.056 (90th percentile 0.25).
Striatum Quant measured at line width 1 before v2.18; on the hand ROIs that moved the whole-arrow mean by 0.003
(median; 90th percentile 0.006).

## Reproducing
`training/striatumHandAtlas-v1/` builds the library and reproduces every number on this card from the ROI sets and
ND2 files (not included: research data). Re-run from an empty working directory on 2026-10-02, it rebuilt the
shipped library exactly and reproduced the placement and measurement figures. `published_sections.md` there records
the test on published sections.

## Suggested methods text
ROIs (dorsoventral, mediolateral and medioventral-to-dorsolateral line profiles and three background boxes) were
placed automatically with Striatum Quant (Toolkit v2.18), which carries ROIs over from the most similar of 249
coronal TH sections whose ROIs were placed by hand (20 animals): sections are matched by normalized
cross-correlation and aligned by enhanced-correlation-coefficient registration, the matches' ROIs are combined by
correlation-weighted median, and arrow ends are adjusted to the striatal edge. Held out by animal, arrow endpoints
fell a median 137 µm from the hand placements, and the resulting normalized profiles reproduced every
control–knockout difference obtained with hand-placed ROIs (effect sizes within 0.11 normalized units, except in one
line whose knockouts retain some TH, where the automatic background boxes made that residual signal read about 0.1
higher). Every automatic placement was reviewed and corrected where needed before measurement.

## Limitations
- Which hemisphere a person quantifies is barely predictable from the image (no measured cue reached an AUC above
  0.65), so "Auto" aims for accuracy instead; where both striata are intact the two sides' expected errors usually
  differ by a few micrometres. Set Left/Right for the batch, or press F / the other-side button to switch.
- Built from far-red or CY3 TH sections of four FloxTH lines. Other stains, magnifications, AP levels outside these
  sections, or heavily damaged sections may match poorly; the match level says so.
- In a view cropped to the striata the two sides look alike; matches are kept on the same side of the midline (the
  section's axis of mirror symmetry) as in the library, but a crop with no clear midline can still land one side over.
- AP levels: the library's sections are mid-striatal. Edge snapping lets the dorsal and lateral ends follow a
  larger rostral striatum, but the ventral ends (DV end, MV-DL start) follow no edge in the hand placements (they
  often run on into dimmer tissue below the striatum, so a rule stopping them where TH falls would move about one in
  five correct ones); in a caudal section they can run below the striatum. Hand-placed caudal sections in the
  library would fix this.
- Mirroring assumes the section is cut close to symmetrically; on a section cut at a slant, a mirrored side can be
  off. It only fires when one striatum is clearly paler and fits worse.
- In Ntsr1 cKO sections the hand noise boxes sit on brighter tissue than in every other group, which the automatic
  boxes do not reproduce, so residual TH reads about 0.1 higher there. Check noise boxes in knockouts with residual TH.
- Placement imitates one person's style. It is a starting point to review, not a measurement.
