You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A modular Python implementation of a three-stage pipeline for automatic spinal vertebrae
localisation and segmentation from CT volumes, based on the VerSe challenge methodology.
Pipeline Overview
graph LR
A["Stage 1<br/>Centerline Localisation<br/>(8 mm U-Net)<br/><br/>Input: full-body CT<br/>(64x64x128)<br/>Output: spine center X, Y"] -->|spine crop<br/>96x96x128| B["Stage 2<br/>Centroid Detection<br/>(SC-Net, 2 mm)<br/><br/>Input: spine crop<br/>(96x96x128)<br/>Output: 25 centroid heatmaps"]
B -->|per-vert crop<br/>128x128x96| C["Stage 3<br/>Per-Vertebra Segmentation<br/>(1 mm U-Net)<br/><br/>Input: per-vert crop<br/>(128x128x96)<br/>Output: binary mask<br/>per vertebra"]
Loading
Stage
Model
Spacing
Input Shape
Output
Loss
1
Modified 3D U-Net
8 mm
[1, 64, 64, 128]
Spine centerline heatmap
Weighted MSE
2
SC-Net (Local Appearance + Spatial Config)
2 mm
[1, 96, 96, 128]
25 centroid heatmaps
Modified L2 + sigma penalty
3
Modified 3D U-Net
1 mm
[2, 128, 128, 96]
Binary segmentation mask
BCE + Dice
Installation
pip install -r requirements.txt
Dataset Format
The pipeline expects a CSV file with these columns:
Column
Description
name
Subject identifier
type
Split: train, val, or test
image_path
Path to the CT NIfTI file (.nii.gz)
mask_path
Path to the segmentation mask NIfTI (optional for Stage 1)
Stage 1: Adam optimiser, weight decay 5e-4, weighted MSE loss (10x for spine regions)
Stage 2: Nesterov SGD (momentum=0.9), weight decay 5e-4, modified L2 loss with learned per-vertebra sigma and alpha=100 penalty
Stage 3: Adam optimiser, weight decay 1e-7, combined BCE + Dice loss (50/50 weighting)
All stages use infinite data iterators (cycling through the dataset) up to a fixed iteration count
Checkpoints are saved on best validation performance; latest state is always saved for crash recovery
Preprocessed patches are cached as .npz files on disk to avoid repeated expensive resampling
About
A modular Python implementation of a three-stage pipeline for automatic spinal vertebrae localisation and segmentation from CT volumes, based on the VerSe challenge methodology.