This repo contains Matlab codes for generating input data and python codes for running Diffusion-QSM.
Diffusion-QSM: diffusion model with time-travel and resampling refinement for quantitative susceptibility mapping https://ieeexplore.ieee.org/document/11147123
Our codes are built upon openai/guided-diffusion, you may install the environment based on openai/guided-diffusion.
- STISuite 3.0
- PyTorch 2.4.1
- Python 3.8
data_prep
test data preparation, run demo.m
to generate data_DiffusionQSM.mat
under data_prep/data
folder
guided_diffusion
files for DDPM and QSM-related codes, important files include gaussian_diffusion.py
and data_consistent.py
weights
trained weight model700000.pt
from Google Drive
QSM_Diffusion_train.py
training code, train the diffusion network using this script
recon.py
inference code, recommend to adjust only in variable args_params
Data preparation
- Generate test data
data_DiffusionQSM.mat
containingphi_use
,mask
,D2
andpad_size
based on thedemo.m
files indata_prep
folder. You can download one test data via Google Drive. - Download the trained weight of the network via Google Drive and place it in
weights
folder - Adjust the
args_params
inrecon.py
Training
- Generate your own training patch-wise dataset (64x64x64 dimension)
- Run
QSM_Diffusion_train.py
for network training
Testing
- Run
recon.py
for generating Diffusion-QSM output - The results are saved under
data_prep/data/results
Feel free to contact [email protected]
for questions/discussions/suggestions.