Skip to content

INFN-MRI/mrops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mrops: Matrix-Free MRI Reconstruction Operators

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.

Key Features

  • 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.

Installation

You can install mrops via pip:

pip install mrops

To use GPU acceleration, make sure you have cuFINUFFT installed:

pip install cufinufft

Getting Started

Here'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 NUFFT

Contributing

We 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.

License

mrops is released under the MIT License.

About

MRI forward operator library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages