Skip to content

PangHaowen-hub/DM-SAM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DM-SAM: Cascaded Diffusion Model and Segment Anything Model for Medical Image Synthesis

Official PyTorch implementation of the paper
"Cascaded Diffusion Model and Segment Anything Model for Medical Image Synthesis via Uncertainty-Guided Prompt Generation and Multi-Level Prompt Interaction"
(IPMI 2025)


🚧 Repository Update in Progress 🚧

🚀 Overview

DM-SAM is a novel framework that integrates the Diffusion Model (DM) and the Segment Anything Model (SAM) for medical image synthesis.
The key idea is to leverage the uncertainty of diffusion model outputs as prompts to guide SAM-based image synthesis refinement.


Figure: Overview of the proposed DM-SAM framework.


🧰 Installation

1️⃣ Create and activate the environment

conda create -n dmsam python=3.10 -y
conda activate dmsam

2️⃣ Install dependencies

pip install -r requirements.txt

📊 Datasets

Experiments in this paper were conducted on three publicly available datasets:

  • BraSyn 2023 — 1,470 MRI scans of brain tumor patients for multi-contrast MRI synthesis.
  • SynthRAD 2023 — 120 paired T1CE–CT brain scans for MRI-to-CT synthesis.
  • SynthRAD 2025 — 258 paired CBCT–CT scans for thoracic cancer radiotherapy planning.

💻 Usage

1️⃣ Data preprocessing

python preprocess/BraSyn.py

2️⃣ Training the Diffusion Model

python DM_train.py

3️⃣ Inference with the Diffusion Model (to obtain mean image and uncertainty map)

python DM_inference.py

4️⃣ Training the SAM-based synthesis model

python SAM_train.py

5️⃣ Testing / Evaluation

python SAM_test.py

🔍 Citation

If you find this repository useful, please cite:

@inproceedings{pang2025cascaded,
  title={Cascaded Diffusion Model and Segment Anything Model for Medical Image Synthesis via Uncertainty-Guided Prompt Generation},
  author={Pang, Haowen and Hong, Xiaoming and Zhang, Peng and Ye, Chuyang},
  booktitle={International Conference on Information Processing in Medical Imaging},
  pages={203--217},
  year={2025},
  organization={Springer}
}

About

Cascaded Diffusion Model and Segment Anything Model for Medical Image Synthesis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages