Skip to content

sanuwanihewa/MRSyn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MRI Synthesis using Adversarial Diffusion

The above figure shows the images in the order of conditional FLAIR contrast, Synthesized T2 contrast and Real T2 contrast

Model Architecture

Dataset Preparation

We will be using 100 middle axial slices of T2 and FLAIR contrasts from Brats dataset and save each as .npy file. You can use the python script data_process.py to prepare the dataset or download sample data from here

The structure of the dataset should be as follows.

data/
├── BRATS/
│   ├── train/
│   │   ├── T2.npy
│   │   └── Flair.npy
│   ├── test/
│   │   ├── T2.npy
│   │   └── Flair.npy
│   ├── val/
│   │   ├── T2.npy
│   │   └── Flair.npy

Model Training

python train.py --image_size 256 --exp exp_syn--num_channels 2 --num_channels_dae 64 --ch_mult 1 1 2 2 4 4 --num_timesteps 4 --num_res_blocks 2 --batch_size 4  --num_epoch 50 --ngf 64 --embedding_type positional --ema_decay 0.999 --r1_gamma 1. --z_emb_dim 256 --lr_d 1e-4 --lr_g 1.6e-4 --lazy_reg 10 --num_process_per_node 1

Model Testing

python test.py --image_size 256 --exp exp_syn --num_channels 2 --num_channels_dae 64 --ch_mult 1 1 2 2 4 4 --num_timesteps 4 --num_res_blocks 2 --batch_size 1 --embedding_type positional  --z_emb_dim 256  --which_epoch 50 --gpu_chose 0 --input_path 'your_input_path' --output_path 'your_output_path'

Download Pre-trained Weights

pre-trained weights

Sample synthesized data

sample-data

Acknowledgements This repository makes liberal use of code from SynDiff

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published