This repository contains the official PyTorch implementation of our paper, “Parallel Swin Transformer-Enhanced 3D MRI-to-CT Synthesis for MRI-Only Radiotherapy Planning,” including training and inference code.
The method performs 3D MRI-to-CT synthesis using a hybrid architecture that combines parallel Swin Transformer branches for global anatomical context with convolutional encoders for local detail. This design improves synthetic CT (sCT) quality, structural consistency, and reliability for MRI-only radiotherapy planning.
Accepted to the IEEE International Symposium on Biomedical Imaging (ISBI) 2026. The final camera-ready manuscript will appear in the conference proceedings.
Figure 1. Overview of the proposed Parallel Swin Transformer-Enhanced Med2Transformer architecture. Each encoder stage fuses dilated convolutional features with multi-scale shifted-window attention from parallel Swin Transformer branches. This design strengthens anatomical representation and improves MRI-to-CT correspondence in 3D volumes.
Figure 2. Qualitative comparison of brain MRI-to-CT synthesis across baseline models and the proposed Med2Transformer. Axial samples demonstrate improved cortical bone delineation, enhanced trabecular detail, and closer structural alignment to the reference CT.
Clone the repository:
git clone https://github.com/mobaidoctor/med2transformer.git
cd med2transformer
pip install -r requirements.txtYour dataset must follow this exact structure:
Task1/
├── brain/
│ ├── train/
│ ├── val/
│ └── test/
└── pelvis/
├── train/
├── val/
└── test/
Inside each split, create one folder per patient:
brain/train/
├── BA001/
├── BA005/
├── BA012/
Inside every patient folder:
BA001/
├── ct.nii.gz
├── mr.nii.gz
└── mask.nii.gz
mr.nii.gz→ MRI volumect.nii.gz→ CT ground truthmask.nii.gz→ body or region mask
Use --data_root to point to Task1/brain or Task1/pelvis.
python3 train.py \
--data_root ../../Task1/brain \
--output_dir results_braintorchrun --nproc_per_node=4 train.py \
--data_root ../../Task1/brain \
--output_dir results_brainAfter training, the output directory will contain:
results_brain/
├── log/ # training logs
├── model_checkpoints/ # saved model weights
├── sample_images/ # visual results during training
├── inference_options.txt # saved inference configuration
├── results.csv # metrics summary
└── train_message.txt # training messages
Run synthesis using a trained checkpoint:
python3 inference.py \
--input_dir ../../Task1/pelvis/test \
--checkpoint model_pelvis.pth \
--output_dir exports_pelvisResults will be saved to:
exports_pelvis/
Pretrained model weights are available for reproducibility and evaluation.
Download the checkpoints from Google Drive, then place them in your project directory.
Available checkpoints:
model_brain.pth
model_pelvis.pth
If you use this code or our work, please cite:
@misc{dorjsembe2026parallelswintransformerenhanced3d,
title={Parallel Swin Transformer-Enhanced 3D MRI-to-CT Synthesis for MRI-Only Radiotherapy Planning},
author={Zolnamar Dorjsembe and Hung-Yi Chen and Furen Xiao and Hsing-Kuo Pao},
year={2026},
eprint={2602.05387},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2602.05387}
}This repository is the official codebase for the associated manuscript and includes the complete implementation of the method.
- Training code ✓
- Inference code ✓
- Pretrained checkpoints ✓
Parts of this codebase are adapted from MTT-Net.
We thank the authors for releasing their implementation.
For questions or collaboration inquiries:
mobaidoctor@gmail.com

