Skip to main content

An interoperable GROG package to accelerate Non-Cartesian MR reconstructions.

Project description

PyGROG

GPU-accelerated GROG (GRAPPA Operator Gridding) for non-Cartesian MRI reconstruction.

PyPI version Read the Docs Tests Docs Check Coverage Ruff Code style: black License: MIT

PyGROG implements the GROG algorithm — a data-driven, parallel-imaging-aware gridding method that maps non-Cartesian k-space samples onto a Cartesian grid using GRAPPA kernels trained from an auto-calibration region. It provides:

  • GROG interpolator (pygrog.calib.GrogInterpolator) — non-Cartesian to Cartesian gridding via fractional GRAPPA operators.
  • SparseFFT operator (pygrog.operator.SparseFFT) — fast sparse forward and adjoint Cartesian FFT for undersampled MRI, with optional sensitivity maps and GPU pipelining.
  • MaskedFFT operator (pygrog.operator.MaskedFFT) — dense-grid masked FFT companion for GROG gridded paths.
  • Reconstruction gadgets (pygrog.gadgets) — off-resonance correction and low-rank subspace projection, stackable on any base operator. Public aliases include SubspaceGadget, OffResonanceGadget, with_subspace, and with_offresonance.
  • Calibration utilities (pygrog.utils) — NLINV coil sensitivity estimation and PCA coil compression.
  • Iterative solvers (op.solve(...), pygrog.solve) — CG/LSMR interfaces that accept torch, NumPy, and CuPy arrays (CuPy via DLPack, no CPU copy).
  • Interoperability (pygrog.interop) — drop-in adapters for mri-nufft, sigpy, mrpro, and deepinverse.

Quick Start

pip install pygrog

CUDA builds are published on GitHub Releases (not on PyPI). If your PyTorch is CUDA-enabled, install the matching PyGROG CUDA wheel with -f:

# CUDA must match your installed torch wheel: cu126 | cu128 | cu130
CUDA=cu128
PYGROG_VERSION=1.0.0

pip install "pygrog==${PYGROG_VERSION}+${CUDA}" \
  -f "https://github.com/FiRMLAB-Pisa/pygrog/releases/expanded_assets/v${PYGROG_VERSION}"

Find your torch CUDA version with:

python -c "import torch; print(torch.version.cuda)"
import numpy as np
from pygrog.calib import GrogInterpolator
from pygrog.operator import SparseFFT

# 1. Build the GROG plan from the non-Cartesian trajectory
grog = GrogInterpolator(shape=(256, 256), coords=coords)

# 2. Fit GRAPPA kernels from the auto-calibration region (ACR)
grog.calc_interp_table(acr_data)

# 3. Grid and reconstruct in one call
image = grog.interpolate(kspace_nc, ret_image=True)

See the documentation for full examples, API reference, and theory.

Documentation

Full documentation (installation, examples, API, theory) lives at https://pygrog.readthedocs.io/en/latest/.

Installation

# CPU (from PyPI)
pip install pygrog

# Development install with all optional dependencies
pip install --no-build-isolation -e ".[dev]"

CUDA wheels are attached to each GitHub Release.

Install them with a torch-scatter-style -f command:

# CUDA must match your installed torch wheel: cu126 | cu128 | cu130
CUDA=cu128
PYGROG_VERSION=1.0.0

pip install "pygrog==${PYGROG_VERSION}+${CUDA}" \
  -f "https://github.com/FiRMLAB-Pisa/pygrog/releases/expanded_assets/v${PYGROG_VERSION}"

Development Style

For contributors, formatting and linting are Ruff-only:

ruff format .
ruff check .

ruff check is configured to apply safe auto-fixes by default.

Related Projects

  • mri-nufft — Non-uniform FFT for MRI
  • mrpro — MRI reconstruction in PyTorch
  • sigpy — Signal processing for inverse problems
  • deepinverse — Deep learning for inverse problems

License

MIT — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pygrog-0.1.2-cp313-cp313-win_amd64.whl (229.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pygrog-0.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (232.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pygrog-0.1.2-cp313-cp313-macosx_12_0_arm64.whl (55.8 MB view details)

Uploaded CPython 3.13macOS 12.0+ ARM64

pygrog-0.1.2-cp312-cp312-win_amd64.whl (229.8 kB view details)

Uploaded CPython 3.12Windows x86-64

pygrog-0.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (231.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pygrog-0.1.2-cp312-cp312-macosx_12_0_arm64.whl (55.8 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

pygrog-0.1.2-cp311-cp311-win_amd64.whl (228.9 kB view details)

Uploaded CPython 3.11Windows x86-64

pygrog-0.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (225.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pygrog-0.1.2-cp311-cp311-macosx_12_0_arm64.whl (55.7 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

pygrog-0.1.2-cp310-cp310-win_amd64.whl (227.9 kB view details)

Uploaded CPython 3.10Windows x86-64

pygrog-0.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (226.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pygrog-0.1.2-cp310-cp310-macosx_12_0_arm64.whl (55.7 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

File details

Details for the file pygrog-0.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pygrog-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 229.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pygrog-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 53613ac25adbff487eb3d329bea543580a942a16d808730a9dac479a738234cf
MD5 e2ed380aebb095002b7f3cedb317d1d0
BLAKE2b-256 d0a4eb6c05430dfeedc5a80fb34c42de487db80fcde424c8d27a982bec5cdf7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp313-cp313-win_amd64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9146cff065ffe91c75c3278f133026c713671f75960d5fa873d21a1cafd66b6e
MD5 7eeaf50096d77bf9f369de5482ce99f2
BLAKE2b-256 11cd7764ebaddc29c40d7c3973ff30008af64d2defd9237b820fc3e7cea52ead

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp313-cp313-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 f54a75da7f189bc1aa4a279ee386fafdf89b39a154102ef9702fab1ce8f26752
MD5 cbbdcc49b4f53d247bcb2e3c7036715b
BLAKE2b-256 18878f207d2471ea63c4855d65b62449ada78b6e435e21ec3d8d19a359af6ab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp313-cp313-macosx_12_0_arm64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pygrog-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 229.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pygrog-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 16958b414a11787b6f72bd5975d5851ea1e15ecffb889700a38844da98197704
MD5 c1de397f6a3c3618349edd14faa9a05d
BLAKE2b-256 6bea2e0fa4591ec13d49e64ca0b16c6bea6447f34c9ed889e14811729ffa854d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp312-cp312-win_amd64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1293d7f0db19ad43ec3e08575c5a2fe6d448e6cfc1c2774bb131e1f36e78f50c
MD5 ec2018d18fbe3ea8f5882e69d0eafaab
BLAKE2b-256 b02a88a051cd13d98eab7ebc46954b5ef33c9008ad3b00e47da48025139ead56

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp312-cp312-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 c55c5a791b9958b309333661442d9031494c987d7cce29ee101258abfc7eca6f
MD5 518c388d4b6cd374bb65a3cda48e7ab0
BLAKE2b-256 7fbab56f5c12a63c9fb5fe3890c2fcc2cb1d71ec57411032ffdc665a13dcc6d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp312-cp312-macosx_12_0_arm64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pygrog-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 228.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pygrog-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 404335f954abaa7086fa66b488e59cfc247bbe3a51ddd165e9d4f58994c24259
MD5 a95d51bf0ec1ce2212507402f4f42bd1
BLAKE2b-256 c1298e75fd3845d34689e7dacb46e01c36851c592c5325d4b8cc784e977c0e08

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp311-cp311-win_amd64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b234ecbbf5b8609cdbb145d6dab6cb27ca99f6469ffd6d71e95560d8cf9626f2
MD5 94259104ab7e31a3a7ac122a31373dd3
BLAKE2b-256 a349d185768066de7a4db8b74e1f2d839083f413b7aba84efdbf43d3240773b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 065ae7d78e1d73f7bd82e0d45dbc97624c6f02069b4ade7118ae029774e3872e
MD5 14f306235dffcc5c0c0ca76016479f5f
BLAKE2b-256 4b0213ddb01144020dca6d16d622155da6c8df012b537ab0e49ada0276c7570b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp311-cp311-macosx_12_0_arm64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pygrog-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 227.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pygrog-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8fa404fbdba9e0f171af7810d53e1caa1ed23733ee2e69a2b63aa9f120ca8add
MD5 a617b3a18659b0fd515e3e390a2a5a42
BLAKE2b-256 6446f2adc293f20853d5ef55d41d4c6d35127ac658bf877cffa445b21625977f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp310-cp310-win_amd64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 be8ec14db62477c6948e11c9063d9011531854d2576aadfd93a3e861ef731fb7
MD5 528c579a1bad6b06940562c5e1ca5b11
BLAKE2b-256 5fbac8c7e67b065916d53f84eb9067514865c5f821c143302056ae317194df9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrog-0.1.2-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.2-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 dce65d8a5ea5d2176aee5997a046f5632f11f7b68facab47589280385d54f7d0
MD5 ae300376d4a75a692230251f6197a7a4
BLAKE2b-256 5c5be4d20264b498ef913b88792d5425894a049ed447853907b16d451d1b819e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.2-cp310-cp310-macosx_12_0_arm64.whl:

Publisher: publish-pypi.yml on FiRMLAB-Pisa/pygrog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page