mrops is a lightweight Python library for matrix-free MRI reconstruction. Built on top of SigPy, mrops provides drop-in replacements for SigPy operators such as NUFFT and FFT, leveraging state-of-the-art implementations like FINUFFT and cuFINUFFT for optimal performance.
Additionally, mrops offers seamless interoperability with scipy.sparse.linalg.LinearOperator and cupyx.scipy.sparse.linalg.LinearOperator, enabling integration with established optimization solvers like Conjugate Gradient (CG) and Least Squares Minimal Residual (LSMR). It also supports PyTorch autograd, allowing its operators to be used in deep learning-based image reconstruction frameworks such as deepinv and DeepInPy.
- Optimized MRI Reconstruction: Drop-in replacements for SigPy's NUFFT, FFT, etc.
- High-Performance Implementations: Uses finufft and cufinufft for acceleration.
- Interoperability with SciPy & CuPy: Compatible with LinearOperator-based solvers.
- PyTorch Support: Enables deep learning-based reconstruction workflows.
- GPU Acceleration: Leverages CUDA-based libraries for efficient computations.
You can install mrops via pip:
pip install mropsTo use GPU acceleration, make sure you have cuFINUFFT installed:
pip install cufinufftHere's a quick example demonstrating how to use mrops:
import mrops
import sigpy as sp
import numpy as np
# Define an MRI sampling pattern
shape = (256, 256)
mask = np.random.rand(*shape) < 0.3 # Simulated undersampling mask
# Create an NUFFT operator using mrops
nufft_op = mrops.NUFFT(shape, mask)
# Apply forward and adjoint operations
img = np.random.randn(*shape) + 1j * np.random.randn(*shape)
kspace = nufft_op * img # Forward NUFFT
img_recon = nufft_op.H * kspace # Adjoint NUFFTWe welcome contributions! If you find a bug, have a feature request, or want to contribute, please open an issue or submit a pull request on our GitHub repository.
mrops is released under the MIT License.