Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coronary Artery Segmentation Pipeline

A lightweight GUI tool that integrates nnUNet and U-Mamba inference with automatic post-processing for coronary artery segmentation in CT images.


Features

Feature Details
Model selection nnUNet (standard), U-Mamba Bot, U-Mamba Enc
One-click inference Wraps nnUNetv2_predict with GUI-configurable parameters
Post-processing Retains the two largest connected components (LCA / RCA) and resolves intra-component label mixing
Live log Streams inference output in real time
Cross-platform Windows / Linux

Directory Structure

coronary_pipeline/
├── coronary_pipeline_gui.py  # Main GUI application
├── postprocess.py            # Post-processing module (importable)
├── requirements.txt
└── README.md

Requirements

Python packages

pip install -r requirements.txt

External tools (must be installed and on PATH)

Tool URL
nnUNet v2 https://github.com/MIC-DKFZ/nnUNet
U-Mamba (optional) https://github.com/bowang-lab/U-Mamba

Pre-trained Models

Pre-trained model checkpoints are available on Hugging Face:

🤗 Download Checkpoints

Download the checkpoints and place them in your model directories:

  • nnUNet/checkpoint_final.pth → your nnUNet model folder
  • UMambaBot/checkpoint_final.pth → your UMambaBot model folder

Then specify each path in coronary_pipeline_gui.py when prompted.

Quick Start

1. Activate your nnUNet / U-Mamba conda environment

conda activate nnunet        # or your environment name

2. Set nnUNet environment variables

# Linux / macOS
export nnUNet_raw="/path/to/nnUNet_raw"
export nnUNet_preprocessed="/path/to/nnUNet_preprocessed"
export nnUNet_results="/path/to/nnUNet_results"

# Windows (PowerShell)
$env:nnUNet_raw          = "C:\path\to\nnUNet_raw"
$env:nnUNet_preprocessed = "C:\path\to\nnUNet_preprocessed"
$env:nnUNet_results      = "C:\path\to\nnUNet_results"

3. Launch the GUI

python coronary_pipeline_gui.py

GUI Screenshot

GUI Screenshot


GUI Usage

  1. Input folder — directory containing CT NIfTI files (case_*.nii.gz)
  2. Output folder — pipeline writes two subdirectories here:
    • raw_predictions/ — direct nnUNetv2_predict output
    • postprocessed/ — top-2 connected-component filtered masks
  3. Model — select nnUNet or U-Mamba variant
  4. Dataset ID / Configuration / Fold / Checkpoint — match your trained model
  5. Save probability maps — passes --save_probabilities to nnUNetv2_predict
  6. Run post-processing — enable/disable the connected-component step
  7. Click ▶ Run Pipeline

Post-processing Logic (postprocess.py)

For each predicted mask:

  1. Binary labeling — all non-zero voxels are treated as foreground.
  2. Connected-component analysisscipy.ndimage.label identifies all components.
  3. Top-N selection — the two largest components are retained (LCA and RCA).
  4. Label-mixing correction — within each retained component, the majority semantic label (1 = LCA, 2 = RCA) is assigned to all voxels, correcting any erroneous minority-label voxels produced by the network.

The module can also be used independently:

from postprocess import run_postprocess

run_postprocess(
    input_dir="path/to/raw_predictions",
    output_dir="path/to/postprocessed",
    top_n=2,
    log_callback=print,
)

3D Slicer Visualization

CT image with coronary segmentation overlay

Overlay

Coronary artery segmentation result

3D Slicer


Citation

If you use this tool in your research, please cite:

Hattori et al. (2026). SlicerPcatMeasure: A 3D Slicer Extension for Pericoronary Adipose Tissue Quantification. SoftwareX. (under review)


License

MIT License — see LICENSE for details.

About

deeplearning based coronary computed tomography angiography segmentation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages