Giter VIP home page Giter VIP logo

med-ddpm's Introduction

Med-DDPM: Conditional Diffusion Models for Semantic 3D Medical Image Synthesis (Whole-Head MRI & 4 Modalities MRI)

[Paper]

This repository contains the official implementation and pretrained model weights for our paper titled "Conditional Diffusion Models for Semantic 3D Medical Image Synthesis." Our research focuses on the utilization of diffusion models to generate realistic and high-quality 3D medical images while preserving semantic information. We trained our proposed method on both whole-head MRI and brain-extracted 4 modalities MRIs (BraTS2021).

For the generation of the 4 modalities (T1, T1ce, T2, Flair), we trained this model using a selected set of 193 high-quality images from the BraTS2021 dataset. We have made our pretrained model weights available for download. Please feel free to use them for further research, and if you use our code or pretrained weights, kindly cite our paper.

Synthetic Samples for Given Input Mask:

Input Mask
Input Mask
Real Image
Real Image
Synthetic Sample 1
Synthetic Sample 1
Synthetic Sample 2
Synthetic Sample 2

๐Ÿ› ๏ธ Setup

Ensure you have the following libraries installed for training and generating images:

pip install -r requirements.txt

๐Ÿš€ Run on Your Own Dataset

Med-DDPM is versatile. If you're working with image formats other than NIfTI (.nii.gz), modify the `read_image` function in `dataset.py`.

  1. Specify the segmentation mask directory with `--inputfolder`.
  2. Set the image directory using `--targetfolder`.
  3. If you have more than 3 segmentation mask label classes, update channel configurations in `train.py`, `datasets.py`, and `utils/dtypes.py`.

๐ŸŽ“ Training

Specify dataset paths using `--inputfolder` and `--targetfolder`:

Image Dimensions

  • Whole-head MRI synthesis: 128x128x128
  • Brain-extracted 4 modalities (T1, T1ce, T2, Flair) synthesis (BraTS2021): 192x192x144
whole-head MRI synthesis:$ ./scripts/train.sh
(BraTS) 4 modalities MRI synthesis:$ ./scripts/train_brats.sh

๐Ÿง  Model Weights

Get our optimized model weights for both whole-head MRI synthesis and 4-modalities MRI synthesis from the link below:

Download Model Weights

After downloading, place the files under the "model" directory.

๐ŸŽจ Generating Samples

To create images, follow these steps:

Image Dimensions

  • Whole-head MRI synthesis: 128x128x128
  • Brain-extracted 4 modalities (T1, T1ce, T2, Flair) synthesis (BraTS2021): 192x192x144

Usage

  • Set the learned weight file path with `--weightfile`.
  • Determine the input mask file using `--inputfolder`.
whole-head MRI synthesis:$ ./scripts/sample.sh
(BraTS) 4 modalities MRI synthesis:$ ./scripts/sample_brats.sh

๐Ÿ“‹ ToDo List

Your contributions to Med-DDPM are valuable! Here's our ongoing task list:

  • Main model code release
  • Release model weights
  • Implement fast sampling feature
  • Release 4 modality model code & weights
  • Deploy model on HuggingFace for broader reach
  • Draft & release a comprehensive tutorial blog
  • Launch a Docker image

๐Ÿ“œ Citation

If our work assists your research, kindly cite us:

@misc{https://doi.org/10.48550/arxiv.2305.18453,
  doi = {10.48550/ARXIV.2305.18453},
  url = {https://arxiv.org/abs/2305.18453},
  author = {Zolnamar Dorjsembe and Hsing-Kuo Pao and Sodtavilan Odonchimed and Furen Xiao},
  title = {Conditional Diffusion Models for Semantic 3D Medical Image Synthesis},
  publisher = {arXiv},
  year = {2023},
}

๐Ÿ’ก Acknowledgements

Gratitude to these foundational repositories:

  1. denoising-diffusion-pytorch
  2. guided-diffusion

med-ddpm's People

Contributors

mobaidoctor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.