Training and evaluation of deep learning models for system matrix restoration in magnetic particle imaging using simulated data.
The code has been developed and tested on AlmaLinux 9.6.
Before proceeding, ensure you have the following software installed:
Once the prerequisites are met, you can set up the environment and install the necessary dependencies by running the following commands in your terminal:
git clone --recurse-submodules -j8 https://github.com/IBIResearch/mpi-sm-restoration.git
conda env create --file env/python/environment.yml
conda activate mpi-sm-restoration
pip install -e env/python/
julia --project=env/julia -t 4 -e 'using Pkg; Pkg.develop(path="env/julia/libs/EquilibriumModelWithAnisotropy"); Pkg.develop(path="env/julia/libs/MNPDynamics"); Pkg.instantiate(); Pkg.precompile()'Download the data from the here, place it in the data/raw directory, and unflatten thefolder structure by running:
cd data/raw
./flatten.sh decode .You should end up with the following structure:
.
├── flatten.sh
├── measurements
│ ├── noise
│ │ ├── 2D
│ │ │ └── noise.npy
│ │ └── 3D
│ │ ├── chunk_1.npy
│ │ ├── chunk_2.npy
│ │ ├── chunk_3.npy
│ │ ├── chunk_4.npy
│ │ └── chunk_5.npy
│ ├── rectangle
│ │ ├── mask.npy
│ │ ├── sm_measured.mdf
│ │ └── u.mdf
│ ├── resolution
│ │ ├── sm_measured.mdf
│ │ └── u.mdf
│ ├── snake
│ │ ├── sm_averaged.mdf
│ │ ├── sm_noisy.mdf
│ │ └── u.mdf
│ └── spiral
│ ├── sm_measured.mdf
│ └── u.mdf
├── models
│ ├── accelerated-calibration
│ │ └── 3D
│ │ └── smrnet
│ │ ├── checkpoint.pt
│ │ └── config.json
│ ├── denoising
│ │ ├── 2D
│ │ │ ├── dncnn
│ │ │ │ ├── checkpoint.pt
│ │ │ │ └── config.json
│ │ │ ├── rdn
│ │ │ │ ├── checkpoint.pt
│ │ │ │ └── config.json
│ │ │ └── swinir
│ │ │ ├── checkpoint.pt
│ │ │ └── config.json
│ │ └── 3D
│ │ ├── dncnn
│ │ │ ├── checkpoint.pt
│ │ │ └── config.json
│ │ └── rdn
│ │ ├── checkpoint.pt
│ │ └── config.json
│ ├── inpainting
│ │ └── 3D
│ │ └── pconvunet
│ │ ├── checkpoint.pt
│ │ └── config.json
│ └── upsampling
│ ├── x2
│ │ └── 2D
│ │ └── smrnet
│ │ ├── checkpoint.pt
│ │ └── config.json
│ └── x4
│ └── 2D
│ └── smrnet
│ ├── checkpoint.pt
│ └── config.json
├── README.md
└── simulation_parameters.json
With that you should be ready to go!
├── data
│ ├── applications
│ └── raw
├── env
│ ├── julia
│ └── python
├── src
│ ├── applications
│ │ ├── accelerated-calibration
│ │ ├── denoising
│ │ ├── inpainting
│ │ └── upsampling
│ ├── pre-processing
│ └── simulation
|
...
data/: Contains datasets, training artifacts, and results.applications/: Contains application-specific data.raw/: Contains raw data provided externally, e.g., real measurements and trained models.
env/: Contains environment definitions for Python and Julia.src/: Contains the main codebase, including simulation, pre-processing, trainining, and evaluation scripts for each application.
To reproduce the study, follow the instructions in the respective folders under src/ in the following order:
simulation/: Generate simulated MPI system matrices.pre-processing/: Prepare data for training.applications/: Train and evaluate models for each application.
If you use this code in your research, please cite the following paper:
@article{tsanda_deep_2026,
title = {Deep {Learning} for {Restoring} {MPI} {System} {Matrices} {Using} {Simulated} {Training} {Data}},
doi = {10.1088/1361-6560/ae6016},
journal = {Physics in Medicine & Biology},
author = {Tsanda, Artyom and Reiss, Sarah and Scheffler, Konrad and Boberg, Marija and Knopp, Tobias},
year = {2026},
}The code has an MIT license, as found in the LICENSE file.
