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

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 Distribution

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

pygrog-0.1.0-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.0-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pygrog-0.1.0-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 7a4c009885e46bbc315d3c3251896ebc24d903e62075be1162b0a1e1e1426f87
MD5 cd8335e9fbd3baedbb43b7d09df254f0
BLAKE2b-256 15ff2a11df5fa7af8cdbe0e92f26e24975f0b09eddef8bf9a8e9d1dde750eb58

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrog-0.1.0-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