Skip to content

odafeng/Auto_CT_Pelvimetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Auto CT Pelvimetry

Automated CT-based pelvimetry pipeline for measuring pelvic bony landmarks, validated against manual 3D Slicer measurements.

Overview

This pipeline extracts 6 pelvic morphometric measurements from CT scans using AI-based segmentation (TotalSegmentator):

Metric Description
ISD Interspinous Distance (mm)
Inlet AP Pelvic Inlet Antero-Posterior Diameter (mm)
Outlet AP Pelvic Outlet Antero-Posterior Diameter (mm)
Outlet Transverse Intertuberous Distance (mm)
Sacral Length Promontory → Coccygeal Apex (mm)
Sacral Depth Maximum Anterior Sacral Concavity (mm)

Additionally, Outlet Area (cm²) is derived as an ellipse approximation (π/4 × Outlet AP × Outlet Transverse).

Repository Structure

├── Pipeline/
│   ├── Combined_Pelvimetry_Pipeline_v6.3.py   # Main pipeline
│   ├── Error_Handling_System.py                # Metric-level error tracking (required)
│   ├── Body_Composition_Analysis.py            # Body composition analysis (see note below)
│   └── requirements.txt                        # Pipeline-specific dependencies
├── Notebooks/
│   ├── 1_Data_Cleaning.ipynb                   # Cohort construction & data merging
│   ├── 2_Validation.ipynb                      # ICC, Bland-Altman analysis
│   └── 3_Clinical_Association.ipynb            # Clinical outcome association
├── README.md
└── .gitignore

Note: Error_Handling_System.py must be in the same directory as the main pipeline. It provides MetricResult, ErrorLogger, and safe_execute for per-metric error isolation and structured failure logging.

Body Composition Analysis

Body_Composition_Analysis.py is a standalone module for computing body composition metrics (VAT, SAT, V/S ratio, skeletal muscle area) at the L3 vertebral level and mid-pelvis (ISD level) from TotalSegmentator tissue-type segmentations. It depends on the pelvimetry pipeline's CSV output for ISD-level slice localization. This module was not used in the current study but is included for reference and potential future analyses.

Requirements

Python Dependencies

pip install -r requirements.txt

External Tools

Tool Purpose Installation
dcm2niix DICOM → NIfTI conversion brew install dcm2niix (macOS)
TotalSegmentator AI anatomical segmentation pip install TotalSegmentator

Usage

Single Patient

cd Pipeline/Main_Pipeline

python Combined_Pelvimetry_Pipeline_v6.3.py \
    --mode single \
    --patient-id Patient_001 \
    --dicom-dir /path/to/Patient_001/DICOM \
    --output-dir /path/to/output

Batch Processing

python Combined_Pelvimetry_Pipeline_v6.3.py \
    --mode batch \
    --input-dir /path/to/all_patients \
    --output-dir /path/to/output

Pre-segmented Data (Pelvimetry Only)

If segmentations already exist:

python Combined_Pelvimetry_Pipeline_v6.3.py \
    --mode measure \
    --nifti /path/to/patient.nii.gz \
    --seg-dir /path/to/segmentation_folder \
    --output-dir /path/to/output

Output

  • CSV: One row per patient with all metric values, anatomical landmark coordinates (World RAS), and pipeline status
  • QC Figures: Sagittal combined and extended axial QC images (per patient)
  • Error Log: Structured error log with per-metric failure taxonomy

Status Codes

Status Meaning
Success All 6 metrics computed
Partial_N/6 N of 6 metrics computed; see Error_Log for details
Failure No metrics computed

License

This project is provided for academic and research purposes.

About

Automated CT pelvimetry pipeline for pelvic bony landmark measurement, validated against manual 3D Slicer measurements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors