A preprocessing pipeline for medical imaging data from the SynthRAD2025 dataset, performing deformable image registration and automatic segmentation for radiation therapy planning.
This pipeline processes CT, MR, and CBCT medical images to:
- Perform deformable image registration between CT and MR/CBCT scans
- Generate automatic segmentations of anatomical structures
- Prepare data for dose calculation in radiation therapy
- Deformable Image Registration: Uses Convex Adam algorithm with MIND (Modality Independent Neighbourhood Descriptor) features
- Automatic Segmentation: Leverages TotalSegmentator for organ-at-risk (OAR) structure segmentation
- Multi-modality Support: Handles MR-to-CT and CBCT-to-CT registration
- Batch Processing: Configuration-based processing of multiple patients
- Quality Control: Generates visualization overlays for registration verification
.
├── preprocessor.py # Main preprocessing class
├── run_preprocessing.py # Entry point for batch processing
├── README.md
├── configs/
│ ├── MR_CT_TH_config.yml # MR thorax dataset configuration
│ ├── CBCT_CT_TH_config.yml # CBCT thorax dataset configuration
│ ├── CBCT_CT_HN_config.yml # CBCT head & neck dataset configuration
│ └── generate_config.py # Utility to generate config files
├── utils/
│ ├── config.py # Configuration loading utilities
│ ├── io.py # Image I/O operations
│ ├── img.py # Image processing utilities
│ ├── reg.py # Registration algorithms
│ ├── seg.py # Segmentation functions
│ ├── vis.py # Visualization utilities
│ └── convex_adam_MIND_gaussian.py # Custom registration implementation
└── docker/
├── Dockerfile
├── docker-compose.yml
└── requirements.txt
- Python 3.13
- CUDA-capable GPU (recommended)
- Docker and Docker Compose
numpy
matplotlib
scipy
SimpleITK
convexAdam
TotalSegmentator
ipykernel
pydantic
- Build and run the container:
cd docker
docker-compose up -d- Access the container:
docker-compose exec doserad bashpip install -r docker/requirements.txtPatient configurations are stored in YAML files in the configs/ directory. Each patient entry contains:
PATIENT_ID:
modality: MR|CBCT
region: TH|HN|AB
ct_path: /path/to/ct.mha
input_path: /path/to/mr.mha # or cbct.mha
sr_mask: /path/to/mask.mha
sr_structures: /path/to/structures/
output_dir: /path/to/output/
ts_segmentation: trueGenerate new configurations using:
python configs/generate_config.pyProcess all patients in a configuration file:
python run_preprocessing.pyOr process individual patients:
from preprocessor import PreProcessor
from utils.config import load_patient_configs
configs = load_patient_configs('./configs/MR_CT_TH_config.yml')
processor = PreProcessor('1THA001', configs['1THA001'])
processor.run_preprocessing()The preprocessing pipeline executes the following steps for each patient:
This pipeline processes data from:
- SynthRAD2025: Training dataset for Tasks 1 (MR-CT) and 2 (CBCT-CT) (Thummerer et al. Med Phys. 2025; 52:e17981. https://doi.org/10.1002/mp.17981)
- Convex Adam Registration: https://pubmed.ncbi.nlm.nih.gov/39283782/
- TotalSegmentator: https://github.com/wasserth/TotalSegmentator
[Add your license information here]
[Add contact information here]