CT Binary Coronary Segmentation
Binary coronary artery segmentation from cardiac CT angiography (CCTA). Produces a binary vessel mask that can be used standalone or as input to the segmental coronary bundle.
Architecture: UNet [64,128,256,512], 1 input channel (CT), 2 output channels (background + vessel) Spacing: 0.6 mm isotropic
Quick Start (Inference)
# Download from HuggingFace
pip install huggingface_hub
huggingface-cli download kbressem/ct-heart-segmentation \
--include "ct_binary_coronary_segmentation/**" \
--local-dir ./
cd ct_binary_coronary_segmentation
# Single model (fold 0)
python -m monai.bundle run inference \
--config_file configs/inference.yaml \
--dataset_dir /path/to/ct_images \
--output_dir /path/to/output
# 5-fold ensemble (recommended)
python -m monai.bundle run inference \
--config_file configs/ensemble_inference.yaml \
--dataset_dir /path/to/ct_images \
--output_dir /path/to/output
# Use a specific fold
python -m monai.bundle run inference \
--config_file configs/inference.yaml \
--dataset_dir /path/to/ct_images \
--fold 2
Input: Directory of CT images in NIfTI (.nii, .nii.gz), NRRD (.nrrd), or DICOM (.dcm) format.
Output: Per-image binary segmentation mask (NIfTI) resampled to original spacing, plus a _centerline.json file containing spline-smoothed vessel centerlines in physical (mm) coordinates.
Requirements
monai>=1.3.0
torch>=2.0
scikit-image
scipy
pandas
psutil
itk
Configuration Files
| File | Purpose |
|---|---|
configs/inference.yaml |
Single-model inference |
configs/ensemble_inference.yaml |
5-fold ensemble inference (best quality) |
configs/train.yaml |
Training config (requires local data manifest) |
configs/metadata.json |
Bundle metadata |
Model Weights
5-fold cross-validation weights in models/:
ct_binary_coronary_segmentation_unet_fold_0.ptthroughfold_4.pt
Preprocessing Pipeline
LoadImaged (ITKReader) -> EnsureChannelFirstd -> Spacingd (0.6mm isotropic)
-> GaussianSmoothd (sigma=0.5) -> ApplyWindowingd (-100 to 900 HU)
-> ZScoreForegroundNormalized (threshold=-50)
Scripts
scripts/transforms.py- Custom transforms (windowing, normalization, centerline extraction)scripts/utils.py- Data loading and inference helpersscripts/losses.py- DiceclDiceLoss (Dice + centerline Dice)scripts/meta.py- Metadata preservation transforms