ribline-anatomical-scf: Anatomically Anchored Semantic Context Forest for 3D Rib Centerline Tracing (CPU-Only)
Official Anatomically Anchored Semantic Context Forest (SCF) checkpoint and 24-rib statistical atlas for ribline (v0.3.0), described in Hybrid Context Forests and Bilateral Viterbi Matching for 3D Rib Centerline Tracing in CT (PDF):
| Hugging Face Repository | Model Variant | 12-Scan LCD (mm) | 12-Scan Acc (%) | 5-Fold CV LCD (mm) | 5-Fold CV Acc (%) |
|---|---|---|---|---|---|
wq2012/ribline-3d-ct-centerline |
Hybrid SCF + 3D U-Net + Stage 3 (Full Suite) | 2.05 +/- 0.48 | 97.2 % | 3.64 +/- 3.90 | 91.8 % |
wq2012/ribline-anatomical-scf |
Anatomically Anchored SCF + Stage 3 (CPU-only) | 2.88 +/- 1.32 | 95.1 % | 5.28 +/- 4.62 | 86.9 % |
wq2012/ribline-3d-unet |
Lightweight 3D U-Net + Stage 3 | 3.40 +/- 1.99 | 92.0 % | 7.44 +/- 8.93 | 78.2 % |
wq2012/ribline-scf-pass2-autocontext |
2-Pass Auto-Context SCF Baseline + Stage 3 | 9.36 +/- 10.57 | 71.0 % | -- | -- |
Architecture and Feature Descriptor (286 Features)
Unlike translation-invariant random forests that rely solely on local intensity patches, the Anatomically Anchored SCF (rib_forest_anatomical.joblib, 150 trees, max depth 24) conditions every tree split on canonical thoracic coordinates relative to the automatically detected lung apex Z_apex and vertebral midline X_spine(Z):
- Multi-Scale Differential Features (28 dims): HU-standardized intensity (
standardize_hu) plus per-scale Gaussian smoothed intensity, gradient magnitude, 6 second-order derivatives, and Laplacian at scalessigma in {1.0, 2.0, 4.0}mm. - Tubularity Proxy (3 dims): Per-scale diagonal-curvature ridge proxy
max(0, -0.5 * (I_yy + I_zz)) * exp(-|I_xx| / (|I_yy| + |I_zz| + 1e-3))atsigma in {1.0, 2.0, 4.0}mm. - Canonical Thoracic Coordinates & Lung Distance (5 dims):
(|u|, u, v, w)whereu = (X - X_spine(Z)) / (0.5 * W_thorax),v = (Y - Y_lung) / (0.5 * W_thorax),w = (Z - Z_apex) / 200 mm, plus Euclidean distanced_lung(mm) to the segmented lung parenchyma. - Random Shift Intensity Differences (250 dims): 250 deterministically seeded (
seed=42) 3D offset pairs in[-12, +12]^3voxels (+/-24 mm) capturing local bone-to-intercostal contrast.
Included Files
| File | Description |
|---|---|
rib_forest_anatomical.joblib |
Trained 150-tree Anatomically Anchored SCF (max_depth=24, 286 features). |
feature_config_anatomical.json |
Exact feature extraction configuration (FeatureExtractor.from_config). |
rib_atlas.joblib |
24-rib statistical shape & topological atlas fitted on the 47 training scans. |
benchmark_val12_fixed_gt.json, benchmark_val12_original_gt.json, benchmark_gt_original_excl_rib007_R07.json, benchmark_noSko.json, benchmark_train47.json, benchmark_cv5.json |
Evaluation reports across the 12-scan eval split, 47-scan train split, and 59-scan 5-fold CV. |
polar_stats_all59.json, gt_fix_log.json |
Azimuthal monotonicity statistics and log of the single ground-truth fix. |
Quick Start
from ribline import load_pretrained_models
# Downloads and instantiates the 24-rib atlas and Anatomically Anchored SCF (CPU-only)
models = load_pretrained_models("wq2012/ribline-anatomical-scf", load_unet=False)
atlas = models["atlas"]
scf_forest = models["forest"]
Or run CLI inference directly:
python -m ribline.scripts.infer_anatomical_scf \
--model pretrained_models/rib_forest_anatomical.joblib \
--image-dir data/vol2mm --split split.json --out-dir predictions/scf_anatomical
Evaluation Protocol and Results
All models were trained on the 47 annotated training scans (1,116 ribs) of the Siemens Corporate Research (SCR) 2 mm thoracic CT benchmark (split.json) and evaluated on the 12 evaluation scans (286 ribs after the documented ground-truth fix in RIB_007, plus 5-fold cross-validation across all 59 annotated scans / 1,402 ribs).
- Labeled Chamfer distance (LCD): mean over all GT ribs of
0.5 * (d_p2g + d_g2p)between each GT rib and the predicted curve with the same label (R01..R12, L01..L12); a GT rib without a predicted curve of that label receives a 50 mm penalty. - Symmetric 10 mm labeling accuracy: a GT rib is counted as correctly labeled if and only if a same-label prediction exists,
d_p2g <= 10 mmandd_g2p <= 10 mm, and the GT rib is the closest GT rib to that prediction.
12-Scan Evaluation Ablation (benchmark_val12_fixed_gt.json, 286 GT ribs)
| Method | LCD (mm) | 95 % CI | UCD (mm) | lab. clDice 3 / 4 mm | Acc all | Acc 1st | Acc 2-11 | Acc 12th | Recall | Precision (FP) | NLD |
|---|---|---|---|---|---|---|---|---|---|---|---|
| RF Pass-1 + Z-sort | 14.10 +/- 11.10 | [7.96, 20.46] | 3.31 | 0.548 / 0.606 | 64.3 % | 79.2 % | 62.9 % | 63.6 % | 91.3 % | 95.5 % (13) | 0.264 |
| SCF Pass-2 + Z-sort | 21.30 +/- 13.33 | [13.79, 28.67] | 4.16 | 0.416 / 0.452 | 43.0 % | 45.8 % | 44.2 % | 27.3 % | 76.2 % | 100.0 % (0) | 0.254 |
| SCF Pass-2 + Stage 3 | 9.36 +/- 10.57 | [4.24, 16.19] | 3.73 | 0.683 / 0.720 | 71.0 % | 54.2 % | 73.8 % | 59.1 % | 78.0 % | 99.6 % (1) | 0.226 |
| Anatomical SCF + Stage 3 | 2.88 +/- 1.32 | [2.23, 3.73] | 2.41 | 0.845 / 0.915 | 95.1 % | 91.7 % | 95.0 % | 100.0 % | 95.1 % | 99.7 % (1) | 0.088 |
| 3D U-Net + Z-sort | 7.57 +/- 7.43 | [3.97, 12.17] | 2.75 | 0.710 / 0.813 | 83.6 % | 70.8 % | 86.7 % | 63.6 % | 92.0 % | 100.0 % (0) | 0.147 |
| 3D U-Net + Stage 3 | 3.40 +/- 1.99 | [2.42, 4.64] | 2.30 | 0.835 / 0.902 | 92.0 % | 66.7 % | 95.4 % | 81.8 % | 93.0 % | 100.0 % (0) | 0.121 |
| Hybrid + Viterbi (no RibSnake) | 2.85 +/- 1.70 | [2.07, 3.95] | 2.11 | 0.872 / 0.933 | 95.8 % | 83.3 % | 97.5 % | 90.9 % | 95.8 % | 99.6 % (1) | 0.147 |
| Hybrid + full Stage 3 | 2.05 +/- 0.48 | [1.80, 2.33] | 1.91 | 0.886 / 0.945 | 97.2 % (278/286) | 91.7 % | 97.5 % | 100.0 % | 97.2 % | 100.0 % (0) | 0.068 |
5-Fold Cross-Validation Across All 59 Annotated Scans (benchmark_cv5.json, 1,402 GT ribs)
| Method | LCD (mm) | 95 % CI | Median LCD | UCD (mm) | lab. clDice 3 / 4 mm | Acc all | Acc 1st | Acc 2-11 | Acc 12th | Recall | Precision (FP) | NLD |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Anatomical SCF + Stage 3 | 5.28 +/- 4.62 | [4.16, 6.56] | 3.08 | 3.44 | 0.769 / 0.840 | 86.9 % (1218/1402) | 72.6 % | 87.7 % | 93.0 % | 90.8 % | 95.3 % (67) | 0.126 |
| 3D U-Net + Stage 3 | 7.44 +/- 8.93 | [5.31, 9.85] | 2.99 | 3.30 | 0.745 / 0.785 | 78.2 % (1097/1402) | 61.5 % | 80.9 % | 67.8 % | 87.0 % | 98.1 % (26) | 0.170 |
| Hybrid + Viterbi (no RibSnake) | 4.17 +/- 4.01 | [3.29, 5.28] | 2.78 | 3.07 | 0.807 / 0.879 | 91.4 % (1282/1402) | 81.2 % | 92.2 % | 93.9 % | 94.3 % | 97.9 % (29) | 0.195 |
| Hybrid + full Stage 3 | 3.64 +/- 3.90 | [2.79, 4.74] | 2.39 | 2.85 | 0.830 / 0.889 | 91.8 % (1287/1402) | 82.9 % | 92.2 % | 96.5 % | 94.6 % | 97.7 % (33) | 0.097 |
Limitations and Protocol Caveats
- 60-scan single-source dataset at 2 mm isotropic spacing; no acquisition metadata; generalization outside SCR is untested.
- The 12-scan evaluation split is the alphabetical tail of the file list (non-random), and the Stage-3 heuristic constants were tuned while inspecting metrics on those 12 scans (while the forests, U-Net, and atlas were fitted strictly on the 47 training scans). See the 5-fold cross-validation table above for out-of-fold generalization across all 59 scans.
- Known annotation issues: merged
R07+R08inRIB_007(fixed ingt_fix_log.json), inconsistent 12th ribs (absent inTsc_004002), and possible patient overlap betweenBro_004029(train) andSko_004029(eval).
Citation
- Paper: https://arxiv.org/abs/2610.16047 (PDF)
@article{wang2026hybrid,
title={Hybrid Context Forests and Bilateral Viterbi Matching for {3D} Rib Centerline Tracing in {CT}},
author={Wang, Quan},
journal={arXiv preprint arXiv:2610.16047},
year={2026},
url={https://arxiv.org/abs/2610.16047}
}