Metadata-Version: 2.4
Name: mri-nufft
Version: 1.6.0
Summary: MRI Non-Cartesian Fourier Operators with multiple computation backends.
Author-email: Pierre-antoine Comby <pierre-antoine.comby@crans.org>
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE.txt
Requires-Dist: numpy>=2.2
Requires-Dist: scipy>=1.13
Requires-Dist: matplotlib>=3.9
Requires-Dist: tqdm
Requires-Dist: typing_extensions
Provides-Extra: gpunufft
Requires-Dist: gpuNUFFT>=0.10.1; extra == "gpunufft"
Requires-Dist: cupy-cuda13x[ctk]; extra == "gpunufft"
Provides-Extra: torchkbnufft
Requires-Dist: torchkbnufft; extra == "torchkbnufft"
Requires-Dist: torch; extra == "torchkbnufft"
Requires-Dist: torchvision; extra == "torchkbnufft"
Requires-Dist: cupy-cuda13x[ctk]; extra == "torchkbnufft"
Provides-Extra: torchkbnufft-cpu
Requires-Dist: torchkbnufft; extra == "torchkbnufft-cpu"
Requires-Dist: torch; extra == "torchkbnufft-cpu"
Requires-Dist: torchvision; extra == "torchkbnufft-cpu"
Requires-Dist: cupy-cuda13x[ctk]; extra == "torchkbnufft-cpu"
Provides-Extra: torchkbnufft-gpu
Requires-Dist: torchkbnufft; extra == "torchkbnufft-gpu"
Requires-Dist: torch; extra == "torchkbnufft-gpu"
Requires-Dist: torchvision; extra == "torchkbnufft-gpu"
Requires-Dist: cupy-cuda13x[ctk]; extra == "torchkbnufft-gpu"
Provides-Extra: cufinufft
Requires-Dist: cufinufft>=2.5.0; extra == "cufinufft"
Requires-Dist: cupy-cuda13x[ctk]; extra == "cufinufft"
Provides-Extra: tensorflow
Requires-Dist: tensorflow-mri>=0.22.0; python_version < "3.11" and extra == "tensorflow"
Provides-Extra: finufft
Requires-Dist: finufft>=2.5.0; extra == "finufft"
Provides-Extra: sigpy
Requires-Dist: sigpy; extra == "sigpy"
Requires-Dist: numba>=0.65; extra == "sigpy"
Provides-Extra: pynfft
Requires-Dist: pynfft3; extra == "pynfft"
Provides-Extra: ducc0
Requires-Dist: ducc0>=0.40.0; extra == "ducc0"
Provides-Extra: pynufft
Requires-Dist: pynufft; extra == "pynufft"
Provides-Extra: pynufft-cpu
Requires-Dist: pynufft; extra == "pynufft-cpu"
Provides-Extra: pynufft-gpu
Requires-Dist: pynufft; extra == "pynufft-gpu"
Provides-Extra: io
Requires-Dist: turbotwix>=0.2.0; extra == "io"
Requires-Dist: pypulseq; extra == "io"
Provides-Extra: extra
Requires-Dist: turbotwix>=0.2.0; extra == "extra"
Requires-Dist: scikit-image; extra == "extra"
Requires-Dist: scikit-learn; extra == "extra"
Requires-Dist: pywavelets; extra == "extra"
Requires-Dist: osqp; extra == "extra"
Requires-Dist: pyproximal; extra == "extra"
Provides-Extra: autodiff
Requires-Dist: torch>=2.12.0; extra == "autodiff"
Requires-Dist: torchvision>=0.27.0; extra == "autodiff"
Requires-Dist: deepinv>=0.4.0; extra == "autodiff"
Provides-Extra: test
Requires-Dist: pytest<8.0.0; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-xdist; extra == "test"
Requires-Dist: pytest-sugar; extra == "test"
Requires-Dist: pytest-cases; extra == "test"
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: doc
Requires-Dist: sphinx-book-theme; extra == "doc"
Requires-Dist: sphinx-copybutton; extra == "doc"
Requires-Dist: sphinxcontrib-video; extra == "doc"
Requires-Dist: sphinx-gallery; extra == "doc"
Requires-Dist: matplotlib; extra == "doc"
Requires-Dist: pooch; extra == "doc"
Requires-Dist: ptwt; extra == "doc"
Requires-Dist: brainweb-dl; extra == "doc"
Requires-Dist: coverage; extra == "doc"
Requires-Dist: fastmri; extra == "doc"
Dynamic: license-file


.. image:: https://github.com/mind-inria/mri-nufft/raw/master/docs/_static/logos/mri-nufft.png
    :width: 200px
    :align: center

|

|Docs| |PyPI|  |colab|

|CI| |CD| |Style| |Coverage| 

|JOSS| |OSI|

*Doing non-Cartesian MR Imaging has never been so easy*



Introduction
------------
   

MRI-NUFFT is an open-source Python library that provides state-of-the-art non-Cartesian MRI tools: trajectories, data loading and fast and memory-efficient operators to be used on laptops, clusters, and MRI consoles.

In particular, it provides a unified interface for computing Non-Uniform Fast Fourier Transform (`NUFFT <https://mind-inria.github.io/mri-nufft/nufft.html>`_), using the specialized backend of your choice (|finufft|_, |gpunufft|_, |torchkbnufft|_, ... ), and with integrated MRI-specific features such as:

- `multi-coil support <https://mind-inria.github.io/mri-nufft/generated/_autosummary/mrinufft.extras.smaps.html>`__ ,
- `density compensation <https://mind-inria.github.io/mri-nufft/generated/_autosummary/mrinufft.density.html>`__,
- `off-resonance correction <https://mind-inria.github.io/mri-nufft/generated/autoexamples/operators/example_offresonance.html>`__.
- `autodiff support <https://mind-inria.github.io/mri-nufft/generated/autoexamples/GPU/index.html>`__.

   
MRI-nufft is a nice and polite piece of software, that will return the same type of array (e.g ``numpy``, ``cupy``, ``torch``) provided at input, without extra copies for conversions.


On top of that we ship a variety of `non-Cartesian trajectories <https://mind-inria.github.io/mri-nufft/generated/autoexamples/trajectories/index.html>`__ commonly used by the MRI community, and even `tools <https://mind-inria.github.io/mri-nufft/generated/autoexamples/trajectories/example_trajectory_tools.html>`__ to helps you develop new ones. 

.. figure:: https://github.com/mind-inria/mri-nufft/raw/master/docs/_static/mri-nufft-scheme.png
   :width: 1000px
   :align: center
   
   *Modularity and Integration of MRI-nufft with the python computing libraries.*



Usage
-----

.. TODO use a include file directive.
.. code-block:: python

    from scipy.datasets import face # For demo
    import numpy as np
    import mrinufft

    # Create 2D Radial trajectories for demo
    samples_loc = mrinufft.initialize_2D_radial(Nc=100, Ns=500)
    # Get a 2D image for the demo (512x512)
    image = np.complex64(face(gray=True)[256:768, 256:768])

    ## The real deal starts here ##
    # Choose your NUFFT backend (installed independently from the package)
    # pip install mri-nufft[finufft] will be just fine here 
    nufft =  mrinufft.get_operator("finufft",
        samples_loc, shape=image.shape, density="voronoi", n_coils=1
    )

    kspace_data = nufft.op(image)  # Image -> Kspace
    image2 = nufft.adj_op(kspace_data)  # Kspace -> Image

    pinv = nufft.pinv_solver(kspace_data) # get a Pseudo inverse (least square minimization)

For improved image quality, embed these steps in a more complex reconstruction pipeline (for instance using `PySAP <https://github.com/CEA-COSMIC/pysap-mri>`_).

Want to see more ?

- Check the `Documentation <https://mind-inria.github.io/mri-nufft/>`__

- Or go visit the `Examples <https://mind-inria.github.io/mri-nufft/generated/autoexamples/index.html>`_


Installation
------------
Recommended: uv
~~~~~~~~~~~~~~~

You can install MRI-nufft in a virtual environment using `uv <https://astral-sh/uv>`__ with::

  uv venv # create a virtual env if needed
  uv add mri-nufft[finufft,cufinufft,extra,autodiff]


Regular pip install
~~~~~~~~~~~~~~~~~~~
MRI-nufft is available on `PyPi <https://pypi.org/project/mri-nufft>`__ and can be installed with::

  pip install mri-nufft

Additionally, you will have to install at least one NUFFT computation backend. See the `Documentation <https://mind-inria.github.io/mri-nufft/getting_started.html#choosing-a-nufft-backend>`__ for more guidance.
Typically we recommend::

  pip install mri-nufft[finufft] 
  pip install mri-nufft[cufinufft] # if you have a NVIDIA GPU and CUDA>=12


Benchmark
---------

A benchmark of NUFFT backend for MRI applications is available in https://github.com/mind-inria/mri-nufft-benchmark


Who is using MRI-NUFFT?
-----------------------

Here are several project that rely on MRI-NUFFT:

- `pysap-mri <https://github.com/CEA-COSMIC/pysap-mri>`_
- `snake-fmri <https://github.com/paquiteau/snake-fmri>`_
- `deepinv <https://github.com/deepinv/deepinv>`_

Add yours by opening a PR or an issue,  let us know how you use MRI-nufft ! 


How to cite MRI-NUFFT
---------------------

We published MRI-NUFFT at `JOSS <https://doi.org/10.21105/joss.07743>`__ :: 

    Comby et al., (2025). MRI-NUFFT: Doing non-Cartesian MRI has never been easier. Journal of Open Source Software, 10(108), 7743, https://doi.org/10.21105/joss.07743

.. code:: bibtex
          
    @article{Comby2025, doi = {10.21105/joss.07743},
        author = {Comby, Pierre-Antoine and Daval-Frérot, Guillaume and Pan, Caini and Tanabene, Asma and Oudjman, Léna and Cencini, Matteo and Ciuciu, Philippe and GR, Chaithya},
        title = {MRI-NUFFT: Doing non-Cartesian MRI has never been easier}, journal = {Journal of Open Source Software},
        url = {https://doi.org/10.21105/joss.07743},
        year = {2025},
        publisher = {The Open Journal},
        volume = {10},
        number = {108},
        pages = {7743},
    } 


Contributing
------------

We warmly welcome contributions ! Check out our `guidelines <https://github.com/mind-inria/mri-nufft/blob/master/CONTRIBUTING.md>`_ , 
Don't hesitate to look for unsolved `issues <https://github.com/mind-inria/mri-nufft/issues/>`__




.. |Coverage| image:: https://raw.githubusercontent.com/mind-inria/mri-nufft/refs/heads/colab-examples/examples/_static/coverage_badge.svg
.. |CI| image:: https://github.com/mind-inria/mri-nufft/actions/workflows/test-ci.yml/badge.svg
.. |CD| image:: https://github.com/mind-inria/mri-nufft/workflows/CD/badge.svg
.. |Style| image:: https://img.shields.io/badge/style-black-black
.. |Docs| image:: https://img.shields.io/badge/docs-Sphinx-blue
    :target: https://mind-inria.github.io/mri-nufft
.. |PyPI| image:: https://img.shields.io/pypi/dm/mri-nufft.svg?logo=pypi&label=pip%20install&color=fedcba
    :target: https://pypi.org/project/mri-nufft/
.. |JOSS| image:: https://joss.theoj.org/papers/10.21105/joss.07743/status.svg
    :target: https://doi.org/10.21105/joss.07743
.. |colab| image:: https://colab.research.google.com/assets/colab-badge.svg
    :target: https://colab.research.google.com/github/mind-inria/mri-nufft/blob/colab-examples/examples/generated/autoexamples/operators/example_readme.ipynb

.. |OSI| image:: https://img.shields.io/badge/DIN%20SPEC%203105-OSI²_CAB:_1.1/60-3498DB?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3BhY2U9InByZXNlcnZlIiBpZD0iRWJlbmVfMSIgeD0iMCIgeT0iM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3bC0xLTItNDUgNnpNMzQ0IDU1QTMzNSAzMzUgMCAwIDAgNTUgMzQ2bDQ2IDVhMjgyIDI4MiAwIDAgMSA5OC0xODVjNDktNDEgMTAwLTU5IDE0OS02NmgxbC01LTQ1em03NSA0NWEyODIgMjgyIDAgMCAxIDI0MiAyMDcgMjQ4IDI0OCAwIDAgMSA5IDQ0bDQ1LTV2LTFjLTYtNTctMzgtMTQwLTk1LTE5NS02Ni02My0xMzEtODctMTk2LTk1bC02IDQ1aDF6IiBjbGFzcz0ic3QxIi8+PHBhdGggZD0iTTU2MCAzMDRhMTk0IDE5NCAwIDAgMS0yMyAyMDFsMzUgMjcgNi04YTIzNCAyMzQgMCAwIDAgNDUtMTU2IDIzMyAyMzMgMCAwIDAtNTEtMTMxbC0zNiAyOWM5IDEyIDIwIDI5IDI0IDM4TTUzMSAxOTdjLTE1LTExLTMwLTIxLTQ4LTI5bC0yMC04LTIwLTZhMjQyIDI0MiAwIDAgMC0yMDUgNDRsMjggMzZhMTkwIDE5MCAwIDAgMSAyMzctMWwyOC0zNnpNMTk4IDIzOWE0ODQgNDg0IDAgMCAwLTI0IDM2bC0xMCAyMmEyMzYgMjM2IDAgMCAwIDMzIDIzM2wzNi0yOC0xNC0yMGMtMjEtMzQtMzUtOTMtMjEtMTQ0bDYtMTggOC0yMGEyOTcgMjk3IDAgMCAxIDIyLTMzbC0zNi0yOHoiIGNsYXNzPSJzdDEiLz48cGF0aCBkPSJNNTMxIDU3M2MtMTUgMTEtMzAgMjAtNDggMjhsLTIwIDktMjAgNWEyNDIgMjQyIDAgMCAxLTIwNS00NGwyOC0zNmExOTAgMTkwIDAgMCAwIDIzNyAybDI4IDM2eiIgc3R5bGU9ImNsaXAtcGF0aDp1cmwoI1NWR0lEXzJfKTtmaWxsOiMzODk1ZDIiLz48L3N2Zz4=&labelColor=white&link=https://gitlab.com/osiiev/cab/-/blob/main/review/projects/MRI-NUFFT/v1.5.0/review_report.md
   :target: https://www.opensourceimaging.org/project/mri-nufft



.. |finufft| replace:: ``(cu)finufft``
.. _finufft: https://github.com/flatironinstitute/finufft

.. |gpunufft| replace:: ``gpunufft``
.. _gpunufft: https://github.com/chaithyagr/gpunufft

.. |torchkbnufft| replace:: ``torchkbnufft``
.. _torchkbnufft: https://github.com/mmuckley/torchkbnufft


