Choosing a NUFFT Backend#
In order to perform Non-Uniform fast Fourier transform for MRI you need to install a computation library backend.
Supported Libraries#
These libraries need to be installed separately from this package.
Backend |
Hardward |
Batch computation |
Precision |
Array Interface |
|---|---|---|---|---|
GPU (CUDA) |
✔ |
single |
cupy/torch/numpy |
|
CPU |
✔ |
single/double |
numpy/torch |
|
GPU |
✔ |
single/double |
numpy/torch/cupy |
|
GPU (CUDA) |
✘ |
single |
tensorflow |
|
CPU |
✘ |
single/double |
numpy |
|
CPU |
✘ |
single/double |
numpy |
|
CPU/GPU |
✔ |
single |
numpy |
|
CPU |
✔ |
single |
numpy |
|
stacked (*) |
CPU/GPU |
✔ |
single/double |
numpy |
(*) stacked-nufft allows one to use any supported backend to perform a stack of 2D NUFFT and adds a z-axis FFT (using scipy or cupy)
The NUFFT operation is often not enough to provide decent image quality by itself (even with density compensation). For improved image quality, use a Compressed Sensing recon. For doing so, you can check the pysap-mri for MRI dedicated solutions and deepinv for Deep Learning based solutions.
Backend Installations#
To benefit the most from certain backends we recommend to use the following instructions
finufft / cufinufft#
Those are developed by the flatiron-institute and are installable with pip install finufft and pip install cufinufft.
Warning
for cufinufft, a working installation of CUDA and cupy is required.
gpuNUFFT#
an active gpuNUFFT fork is maintained by chaithyagr.
To install it use pip install gpuNUFFT or for local development, use the following:
git clone https://github.com/chaythiagr/gpuNUFFT
cd gpuNUFFT
python setup.py install
Warning
If you are using uv as your package installer you will need to do
.. code-block:: sh
uv pip install wheel pip pybind11
uv pip install mri-nufft[gpunufft] --no-build-isolation
BART#
BART has to be installed separately and bart command needs to be runnable from your PATH. See installation instructions
PyNFFT#
PyNFFT requires Cython<3.0.0 to work. and can be installed using
pip install cython<3.0.0 pynfft2
Which backend to use#
We provided an extensive benchmark on computation and memory usage on mind-inria/mri-nufft-benchmark
Tip
Overall, we recommend to use finufft for CPU, and cufinufft or gpunufft when CUDA GPU are available.