This repository provides tools for processing, segmenting, evaluating, and classifying CT images, with a focus on atlas-based segmentation and random forest classification. The code is modular and uses Python with SimpleITK.
- Pre-processing: Load and prepare CT images and masks.
- Registration: Linear and non-linear (Demons) registration using SimpleITK.
- Atlas-based Segmentation: Majority voting from registered masks.
- Evaluation: Computes Dice, Jaccard, and Hausdorff metrics.
- Classification: Random forest classifier to identify slices containing the pubic symphysis.
- Visualization: Plotting of images and segmentation overlays.
.
├── main.py # Main script for running the pipeline
├── functions.py # Core functions for registration, segmentation, evaluation, and classification
├── requirements.txt # Python dependencies
├── README.md
└── .gitignore
- Python 3.8+
- See requirements.txt for dependencies
git clone https://github.com/yourusername/your-repo.git
cd Python-CT
pip install -r requirements.txt
- Place your CT images and masks in the appropriate folders (see paths in
Main.py
). - Run the main script:
python Main.py
- The script will:
- Load images and masks
- Perform registration and segmentation
- Evaluate segmentation quality
- Train and apply a classifier
- Display plots of results
- Main.py: Entry point; orchestrates the workflow.
- functions.py: Implements registration, segmentation, evaluation, and classification functions.
- requirements.txt: Lists required Python packages.
- Dice, Jaccard, and Hausdorff metrics printed to console.
- Plots showing reference images, segmentations, and overlays.
- Slice indices with highest probability for pubic symphysis.
- Image and mask file paths are hardcoded in
Main.py
. Adjust as needed for your dataset. - The code assumes images are in NIfTI format (
.nii.gz
). - For more advanced usage or batch processing, consider extending the scripts or modularizing further.
MIT License
Maintained by David Dashti. For questions or suggestions, please open an issue or contact me.