Skip to main content

PyTorch-based ESPIRiT coil sensitivity calibration for MRI

Project description

ESPIRiT

PyTorch-based ESPIRiT coil sensitivity calibration for MRI.

Single codebase that runs on CPU, CUDA GPU, and Apple Silicon (MPS) — no separate code paths needed.

Notice

This package contains a PyTorch translation of the ESPIRiT implementation from the BART (Berkeley Advanced Reconstruction Toolbox), © 2013–2026 The Regents of the University of California and BART Developer Team. BART is licensed under the BSD 3-Clause License. See https://codeberg.org/mrirecon/bart.

Installation

uv add espirit

Usage

Command Line

uvx espirit kspace.npy

Python API

import numpy as np
import torch
from espirit import espirit

# NumPy
kspace_np = np.load("kspace.npy")
csm_np = espirit(kspace_np)

# PyTorch 
kspace_torch = torch.randn(8, 24, 24, 24, dtype=torch.complex64)
csm_torch = espirit(kspace_torch)

Advanced

All arguments for the espirit() function:

csm = espirit(
    kspace,             # (n_coils, *spatial_dims)
    calib_size=24,      # size of calibration region
    kernel_size=6,      # sliding-window kernel size
    threshold=0.01,     # relative singular-value threshold
    mask_threshold=0.8, # eigenvalue mask threshold
    normalize=True,     # RSS=1 normalization
    rotphase=True,      # remove global phase ambiguity
    device=None         # auto-detect (cuda, mps, cpu)
)

Device support

Device Backend Notes
cpu NumPy/MKL Always available
cuda NVIDIA GPU Requires CUDA toolkit
mps Apple Metal macOS with Apple Silicon

The same code runs on all devices — PyTorch handles dispatch automatically.

Project details


Download files

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

Source Distribution

espirit-0.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

espirit-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file espirit-0.1.0.tar.gz.

File metadata

  • Download URL: espirit-0.1.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for espirit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b151755d5b6acee7b29313041905a01e3b9d47b5b3114912fcc56f8ad7c7b217
MD5 3f89a99f1c25d5e44079a0ff9c8ef5c7
BLAKE2b-256 a677e32cb3f71f07792299a3977199ce87878b8be7b2897de09db5b954194b3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for espirit-0.1.0.tar.gz:

Publisher: python-publish.yml on oscarvanderheide/espirit

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

File details

Details for the file espirit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: espirit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for espirit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c23059eb66f9e7fb4d0e3a2985cf5115f8b52426821f76f2a6c85d6ec64dcbcc
MD5 45bc26b6c838e4db09a94e67671203b4
BLAKE2b-256 56e5d8adaef29f6e0e02e1cec63440e34305c64ac8b5d03880f9f333149f5987

See more details on using hashes here.

Provenance

The following attestation bundles were made for espirit-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on oscarvanderheide/espirit

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