• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Try several methods for MRI reconstruction on the fastmri dataset. Home to the XPDNet, runner-up of the 2020 fastMRI challenge.

fastMRI reproducible benchmark

GitHub Workflow Build Status Binder

The idea of this repository is to have a way to rapidly benchmark new solutions against existing reconstruction algorithms on the fastMRI dataset single-coil track. The reconstruction algorithms implemented or adapted to the fastMRI dataset include to this day:

  • zero filled reconstruction
  • LORAKS, using the LORAKS Matlab toolbox
  • Wavelet-based reconstruction (i.e. solving an L1-based analysis formulation optimization problem with greedy FISTA), using pysap-mri
  • U-net
  • DeepCascade net
  • KIKI net
  • Learned Primal Dual, adapted to MRI reconstruction
  • XPDNet, a modular unrolled reconstruction algorithm, in which you can plug your best denoiser.
  • NCPDNet, an unrolled reconstruction algorithm for non-Cartesian acquisitions, with density-compensation.

All the neural networks are implemented in TensorFlow with the Keras API. The older ones (don't judge this was the beginning of my thesis) are coded using the functional API. The more recent ones are coded in the subclassed API and are more modular. For the LORAKS reconstruction, you will not be able to reconstruct the proper fastMRI data because of the A/D oversampling.

Examples

Various examples are available in the examples folder.

  • The mri_reconstruction_intro.ipynb notebook compares the performance of classical wavelet-based reconstruction (using the pysap-mri package) and deep learning based approaches like the CascadeNet and the UPDNet on a slice from the fastMRI single coil dataset in a 2D Cartesian setting.
  • The non_cartesian_reconstruction.ipynb notebook showcases the use of the NCPDNet.

These examples can be run in binder.

Pretrained model checkpoints

Some model checkpoints are available in the HuggingFace Hub. You can either download them manually, clone the model repository, or use the huggingface-hub package like:

from huggingface_hub import hf_hub_download

REPO_ID_BASE = 'zaccharieramzi/{model_name}'
repo_id = REPO_ID_BASE.format(model_name='... the model name')
model_weights_path = hf_hub_download(
    repo_id=repo_id,
    filename='model_weights.h5',
)

Use cases for each model are explained in the respective model cards on the HuggingFace Hub under the "How to use" section.

Reconstruction settings

The main reconstruction settings are Cartesian single-coil and multi-coil 2D reconstruction with random and "periodic sampling". These settings are covered by almost all the networks in this repo, mainly because they are the settings of the fastMRI challenge.

Other reconstruction settings

Non-cartesian: you can reconstruct non-Cartesian data using the NCPDNet. It relies on the TensorFlow implementation of the NUFFT, tfkbnufft. This network will allow you to work on 2D single-coil and multi-coil data, as well as 3D single-coil data.

Deep Image Prior: you can also reconstruct non-Cartesian data in an untrained fashion using the DIP model. This idea originated from the Deep Image Prior paper, and was later adapted to MRI reconstruction by different works (Accelerated MRI with untrained Neural networks, Time-Dependent Deep Image Prior for Dynamic MRI). It currently is only used for 2D non-Cartesian data (primarily for computation time reasons), but you can extend it easily to 2D Cartesian data and 3D (PRs welcome).

How to train the neural networks

The scripts to train the neural networks are located in fastmri_recon/training_scripts/. You just need to install the package and its dependencies:

pip install . &&\
pip install -r requirements.txt

How to write a new neural network for reconstruction

The simplest and most versatile way to write a neural network for reconstruction is to subclass the CrossDomainNet class. An example is the PDnet

Reproducing the results of the paper

To reproduce the results of the paper for the fastMRI dataset, run the following script (here for the PD contrast):

python fastmri_recon/evaluate/scripts/paper_eval.py --contrast CORPD_FBK

To reproduce the results of the paper for the OASIS dataset, run the following script (here for fewer samples):

python fastmri_recon/evaluate/scripts/paper_eval_oasis.py --n-samples 100

Finally, to reproduce the figures of the paper, you will need to use the qualitative_validation_for_net notebook.

Downloading the model checkpoints

The model checkpoints are stored in the HuggingFace Hub. You can download them using the following script, which will automatically put them in the correct directory (for example here the fastMRI models):

python fastmri_recon/evaluate/scripts/download_checkpoints.py

Data requirements

fastMRI

The fastMRI data must be located in a directory whose path is stored in the FASTMRI_DATA_DIR environment variable. It can be downloaded on the official website after submitting a request (bottom of the page).

The package currently supports public single coil and multi coil knee data.

OASIS

The OASIS data must be located in a directory whose path is stored in the OASIS_DATA_DIR environment variable. It can be downloaded on the XNAT store after creating an account. You can for example use the ZIP download available on this page. The project is OASIS3. The whole list of sessions that need to be downloaded is available in OASIS_list.csv.

Citation

This work will be presented at the International Symposium on Biomedical Imaging (ISBI) in April 2020. An extended version has been published in MDPI Applied sciences. If you use this package or parts of it, please cite one of the following work:

Applications

This package has been used to perform MRI reconstruction in the following projects (in addition to the ones mentioned above):

More Repositories

1

tfkbnufft

A robust, easy-to-deploy non-uniform Fast Fourier Transform in TensorFlow.
Python
29
star
2

tf-slice-assign

A tool for assignment to a slice in TensorFlow
Python
18
star
3

jz-hydra-submitit-launcher

A utility to be able to launch jobs on JZ with reasonable defaults
Python
17
star
4

submission-scripts

All the submission scripts used for my work on Jean Zay and the TGCC
Shell
10
star
5

PhD-defense-presentation

My defense presentation
TeX
9
star
6

understanding-unets

Learnlets repository
Jupyter Notebook
8
star
7

tf-mwcnn

An unofficial TensorFlow implementation of the MWCNN
Python
7
star
8

grappa

A repository to experiment on GRAPPA, with a TF backend. It also features some experiments on deep versions of GRAPPA
Python
7
star
9

shine

Code for the DEQ experiments of the ICLR 2022 spotlight "SHINE: SHaring the INverse Estimate from the forward pass for bi-level optimization and implicit models"
Python
7
star
10

tf-focnet

An unofficial tensorflow implementation of the FocNET
Python
5
star
11

tf-complex

A package to easily install tensorflow utils for complex-valued tensors and neural networks
Python
4
star
12

my-model-zoo

A list of all the neural networks I have implemented
3
star
13

tf-unet

An unofficial TensorFlow implementation of the U-net
Python
3
star
14

phylo-hmm

Implementation of the work done in the Phylogenetic Hidden Markov Model by Adam Siepel and David Haussler
Jupyter Notebook
3
star
15

tf-didn

An unofficial implementation of the Deep iterative down-up CNN for image denoising
Python
2
star
16

local-machine-setup

Repo to keep my setups on different local instances. Inspired by: https://github.com/joejuzl/dotfiles
2
star
17

git-tuto

A very sparse repo to practice the basics of git and GitHub flow in open source
Python
2
star
18

tf-fastmri-data

TensorFlow data pipelines for the fastMRI dataset
Python
1
star
19

tf-tdv

An unofficial TensorFlow implementation of Total Deep Variation model
Python
1
star
20

mva-courses

Courses I take at MVA during my second PhD year.
Jupyter Notebook
1
star
21

gml-project

Project for Graphs in machine learning class : correlation clustering
Jupyter Notebook
1
star
22

kernel-digits-challenge

A repo to host our code for the challenge suggested in the Kernel Methods course of MVA
Jupyter Notebook
1
star
23

rl-project

Reinforcement Learning project on multi-player bandits. This project is basically an implementation of different collision avoidance techniques for a benchmark.
Jupyter Notebook
1
star