Vertebral Anatomy as a Minimal Program

Deep segmentation networks trace vertebrae well but count them badly. On the CTSpine1K benchmark, a 3D nnU-Net (the standard self-configuring segmentation network) scores Dice "close to zero" on patients with a transitional vertebra, meaning an extra lumbar level (L6) or a missing one (L5) (CTSpine1K). On VerSe, strong models often draw the right bone shapes but label every level one step off, for example calling T12 "L1" (VerSe). These are not errors of local image evidence. They are errors of global structure: how many repeated units there are, and where the chain is anchored. Networks trained on images where almost everyone has the usual count never learn to question that count.

We propose treating the spine as a short program, "repeat a vertebra-shaped part N times along a curved axis, then attach a sacrum," and choosing the program that explains the scan in the fewest bits. The total description length has three parts: the program's discrete structure (the loop count and any rare edits such as fusion), its continuous parameters, coded under an anatomical prior learned from normal spines, and the leftover mismatch between the rendered program and the network's per-voxel vertebra probabilities. The continuous parameters are fitted by gradient descent through a renderer whose boundaries have been smoothed. The discrete structure is searched symbolically, cheapest first. The claim is that minimum description length (MDL, the principle that the best explanation is the shortest total encoding of theory plus data) gives the right answer on transitional anatomy. It adds a vertebra only when the extra part pays for its own bits. A fixed-count template cannot do this, and neither can a network that has never seen the case.

Core Claim

The quantity we minimize for a candidate program $P$ with discrete structure $s$ and continuous parameters $\theta$ is

$$ \mathrm{DL}(P) = L(s) + L(\theta \mid s, \text{prior}) + L(Y \mid \mathrm{render}(s,\theta)). $$

Here $L(s)$ is the code length of the syntax tree under a grammar that makes the common structure cheap and rare edits expensive. $L(\theta \mid s, \text{prior})$ is the negative log-density of the parameters under a statistical model of vertebral size, spacing, orientation and curvature, fitted on CTSpine1K training labels. $L(Y \mid \cdot)$ is the negative log-likelihood of the nnU-Net foreground probability volume $Y$ given the program's rendered occupancy.

Two design choices separate this from existing work. First, the anatomical prior enters as the code for the continuous parameters, not as a separate loss with a hand-tuned weight. This gives one principled answer to the open problem of how to penalize mixed continuous-discrete geometric programs, and it removes the loss-weight tuning that CardioComposer reports needing for its moment-based guidance. Second, each discrete candidate is scored only after a brief gradient refinement of its parameters, never on its raw initial fit. This is our proposed fix for the "gap problem" in metric program synthesis. In SyMetric, a needed sub-part starts far from the target and gets pruned before it can be placed correctly.

Relation to Prior Work

Two systems each supply half of the method, and each leaves open exactly what the other provides. DiffCSG makes rendering of boolean shape trees differentiable by handling their sharp intersection edges inside an antialiasing rasterizer. It fits primitive parameters in seconds, but its authors state it "only optimizes continuous parameters" of a fixed tree. It therefore cannot add the missing sixth lumbar vertebra. SyMetric searches tree structure by grouping candidates whose outputs lie within a distance radius, and it solves 78% of its 2D inverse-CSG tasks. It adjusts coordinates by discrete hill-climbing, however, and it suffers from the gap problem. We reuse DiffCSG's idea of hard forward rendering with a smoothed backward pass, in the spirit of Rasterize-then-Splat and Neural 3D Mesh Renderer. We borrow SyMetric's search skeleton, but replace its pruning with post-refinement scoring.

The simplicity bias comes from program synthesis. Overfitting in Synthesis shows that expressive grammars make synthesizers overfit. It reports verification rounds rising from 19 to 88, and it proposes Hybrid Enumeration, which exhausts simple subgrammars before opening richer ones. We adopt this ordering: count changes come first, then fusion or partial-sacralization edits. Bayesian program induction of grammar rules (Ellis et al.) and integer-sequence induction (Gauthier et al.) motivate program length as a proxy for generalization. Both work in purely discrete domains. We extend the idea to programs whose parameters are real-valued and whose data are images.

On the anatomy side, learned shape priors motivate the problem but also constrain the design. Dalca et al. use a VAE (a variational autoencoder, a network that compresses shapes to a small latent code) and report over-smoothed fine detail. CardioComposer guides a diffusion model with differentiable volume, centroid and covariance moments, and it acknowledges disconnected outputs. Karani et al. use a denoising autoencoder as a test-time shape filter. All three represent shape as dense voxels, so none can express "exactly one more vertebra." We keep their lesson that a global prior is needed, but place it on program parameters. Topology and part count are then explicit by construction.

Research Program

We will build a small spine grammar. Each vertebra is a CSG composite: a body cylinder, a cut-out ring for the canal, and a posterior element. It is parameterized by scale, pose, and position along a spline axis. A loop places N copies. A sacrum primitive anchors the lower end. Edit operators insert or delete a level, fuse a lowest lumbar level with the sacrum, or truncate at the field-of-view edge, which is common in VerSe.

The renderer produces a hard occupancy volume, used for exact residual scoring. Its backward pass smooths boundaries so gradients reach pose and scale. For the 3D setting we adapt DiffCSG's edge treatment from image rasterization to voxel occupancy, and we also support projection rendering for the bi-planar radiograph setting used by ReVerteR.

The search proceeds in stages. It enumerates structures in order of increasing $L(s)$. Each candidate is warm-started from the parent's fitted parameters and gets K gradient steps. It is then scored by DL, and a beam of the best-scoring candidates is kept. The parameter prior is a Gaussian (later a mixture) over per-level parameters and inter-level spacing, fitted on CTSpine1K training labels only. Final labels come from the program's loop index counted from the sacral anchor, and voxels are assigned to the nearest fitted part within the nnU-Net foreground.

We will also analyze where MDL decides. We will plot the DL difference between the N=24 and N=25 hypotheses against the size of the residual an unmodelled extra vertebra would leave. This shows how much image evidence is needed before the extra level pays for its bits, and whether that threshold is anatomically sensible.

Baselines

The naive reference point is the 3D full-resolution nnU-Net trained on the 610 CTSpine1K training subjects, used as released in CTSpine1K with its own labels. The paper reports Dice "close to zero" on transitional cases. No aggregate internal-test Dice/HD95 decimal is available in the file, so we will measure it ourselves on the public test set.

The strongest reported competitors on labeling are the VerSe challenge winners. The file reports identification rate of 94.25% with Dice of 89.80% for 2019, and identification rate of 96.6% with Dice of 91.72% for 2020 (VerSe). We cannot rerun those systems. We therefore compare against the published numbers on the VerSe test protocol, and we treat our retrained nnU-Net as the controlled stand-in. Beating the field means exceeding 96.6% identification rate overall without losing Dice. The more important target is a large gain on the transitional and truncated subsets, where the published aggregate hides failures.

The most dangerous simple competitor is nnU-Net binary vertebra segmentation followed by a hand-written rule: split connected components, count them from the sacrum upward, and relabel. It uses the same probability map our method consumes and costs almost nothing. Beating it requires fewer label errors specifically on transitional, fused, or touching vertebrae, where component counting is ambiguous.

The shape-prior competitor is test-time adaptation with a denoising-autoencoder prior (Karani et al.). It lifted Dice from 0.107 to 0.733 on T1-to-T2 brain MRI and from 0.609 to 0.858 on prostate. We retrain it on CTSpine1K labels and test on the CTSpine1K-to-VerSe shift that the CTSpine1K authors report as "much worse."

Three ablations isolate our ingredients. The first is fixed-template gradient fitting with N=24 and no structure search, which is DiffCSG applied to anatomy. The second is exhaustive template enumeration over N in {23, 24, 25}, scored by penalized residual (a BIC-style criterion), with no edit grammar and no anatomical parameter code. The third is our full search with the parameter prior removed, and separately with pruning on raw rather than refined fits.

All methods receive the same nnU-Net probability volumes and the same per-scan wall-clock budget. Hyperparameters are tuned only on a held-out part of CTSpine1K training, with VerSe untouched until final evaluation.

Why not just…?

Why not just count connected components of the nnU-Net output? This is a real threat, and it is the baseline the proposal most needs to beat. Counting works when vertebrae are cleanly separated. It fails exactly where the clinical errors live: a sacralized L5 fuses with the sacrum, touching or fractured levels merge, and truncated scans lack an anchor. Any fixed rule then needs a hand-coded exception. Our experiment breaks results down by these subsets. If counting matches us on them, we will report that the program machinery adds nothing to labeling and restrict our claims to shape and editability.

Why not just enumerate a few templates with different vertebra counts and pick the best penalized fit? For pure count selection, this is nearly our method with a cruder penalty. That is why it is an ablation rather than a straw man. The difference should appear in two places: where the correct explanation needs an edit other than a count change, and where the anatomical parameter code, rather than a flat per-parameter penalty, is what makes an extra level too costly or worth adding. If template enumeration ties us everywhere, the honest conclusion is that the grammar is unnecessary and the parameter prior is the contribution.

Why not just use a learned voxel shape prior such as a diffusion model or autoencoder? These priors improve Dice under domain shift (Karani et al.). But they smooth thin structures (Dalca et al.), can disconnect parts (CardioComposer), and have no variable for "how many vertebrae." A prior trained mostly on 24-level spines will pull a 25-level spine back toward 24. The transitional-subset comparison tests this directly.

Why not just fine-tune nnU-Net on more transitional cases? Such cases are rare, and the CTSpine1K result shows the network does not generalize to them from the available data. Oversampling is a fair extra baseline, and we will include it. Its ceiling, however, is bounded by how few examples exist, whereas MDL needs no examples of the anomaly.

Proposed Experiments

The primary experiment evaluates identification rate, per-vertebra Dice, and HD95 on the CTSpine1K public test set and on VerSe. The transitional subset is identified from ground-truth L6 labels or an absent L5. Truncated-field-of-view and metal-artifact cases are reported as separate strata. The decisive check is whether our method removes the near-zero Dice on transitional cases and the one-level label shift, while staying within about one Dice point of nnU-Net on normal spines. A method that fixes counting but distorts ordinary anatomy is not useful.

A second, cheap experiment tests the gap-problem claim in isolation on SyMetric's 40 2D inverse-CSG tasks. We compare SyMetric's reported 78% success rate against the same search with pruning applied after K gradient steps through a differentiable 2D CSG rasterizer, at matched wall-clock budget. If refine-before-prune does not solve more tasks there, the search contribution fails, independent of anatomy.

A third experiment probes calibration of the MDL decision. On synthetic spines rendered from the program with a vertebra progressively faded out, we measure at what contrast the method switches its count. We check whether the DL margin tracks actual labeling accuracy on real scans, so that it can serve as an uncertainty flag for radiologist review.

Finally, as a secondary setting, we run the same search on VerSe digitally reconstructed bi-planar radiographs using projection rendering. We compare reconstruction Dice against the 0.7938 reported by ReVerteR, and report level labeling on transitional cases, where a per-vertebra reconstruction network has no mechanism to change the count.