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
Our codes are built upon guided-diffusion, you may install the environment based on 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
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
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.