Skip to main content

Standalone fastMRI prostate T2 and diffusion regridding, GRAPPA filling, and complex IFFT outputs.

Project description

fastmri_tools

Standalone reconstruction helper for fastMRI prostate T2 and diffusion HDF5 files.

The project is intentionally self-contained: it does not import anything from the parent repository. Runtime dependencies are ordinary pip packages listed in pyproject.toml.

What it does

For each input MRI HDF5 file, the pipeline:

  1. Loads kspace, calibration_data, and the ISMRMRD header.
  2. Detects T2 or diffusion data, or uses the sequence passed on the command line.
  3. Applies trapezoidal EPI regridding for diffusion data when header parameters are present. T2 data keeps its Cartesian readout grid.
  4. Fills missing samples with GRAPPA using the calibration data.
  5. Computes a centered complex inverse FFT from the filled k-space.
  6. Writes complex outputs with the same dimensions as the original input k-space: (averages, slices, coils, readout, phase).

The output HDF5 contains:

  • kspace_regridded: complex k-space after diffusion regridding, or a copy of the input k-space for T2.
  • kspace_grappa: complex GRAPPA-filled k-space.
  • image_complex: complex centered inverse FFT of kspace_grappa.
  • image_complex_coil_combined: diffusion only, when coil_sens_maps is available in the source file. This is still complex and has shape (averages, slices, readout, phase).

Install

From PyPI, once the first release has been published:

python -m pip install fastmri_tools

From GitHub:

python -m pip install git+https://github.com/meis-01/fastmri_tools.git

For local development:

python -m venv .venv
.\.venv\Scripts\python -m pip install -U pip
.\.venv\Scripts\python -m pip install -e ".[dev]"

Run one file

fastmri-tools reconstruct `
  --input C:\path\to\file.h5 `
  --output C:\path\to\recon_complex.h5 `
  --sequence auto

Use --sequence t2 or --sequence dwi to override auto-detection.

Run a folder

fastmri-tools reconstruct `
  --input C:\path\to\h5_folder `
  --output C:\path\to\output_folder `
  --sequence auto

The command writes one output HDF5 per input file.

Quick synthetic check

This creates a tiny synthetic T2-like file and reconstructs it:

fastmri-tools make-synthetic --output .\synthetic_t2.h5 --sequence t2
fastmri-tools reconstruct --input .\synthetic_t2.h5 --output .\synthetic_t2_recon.h5 --sequence t2

Inspect the output:

fastmri-tools inspect .\synthetic_t2_recon.h5

The module entry points also work:

python -m fastmri_tools inspect .\synthetic_t2_recon.h5

Publish a release

This repository includes GitHub Actions for CI and PyPI publishing.

  1. Create a PyPI project or pending publisher for fastmri_tools.
  2. Configure PyPI Trusted Publishing with:
    • Owner: meis-01
    • Repository name: fastmri_tools
    • Workflow name: publish.yml
    • Environment name: pypi
  3. Create and publish a GitHub release such as v0.1.0.

GitHub Actions will build the source distribution and wheel, then publish them to PyPI without storing a PyPI API token in GitHub secrets.

Notes

  • The complex inverse FFT is intentionally not converted to RSS magnitude. This preserves phase and coil information.
  • Output spatial dimensions match the loaded k-space dimensions. No T2 zero padding or center cropping is applied.
  • Diffusion regridding is skipped automatically if the ISMRMRD header does not contain the needed EPI timing fields.

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

fastmri_tools-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

fastmri_tools-0.1.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fastmri_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac3e8d47aa623337b8c9c286f3df1707c6ee9b084ca9d083120960e70ec541c9
MD5 3e63b9dd32d1bc1a6a0ee3b0827c6aa4
BLAKE2b-256 d032a3776b0b26a4e40bb8aa4410a46d5c9f8f92dbab880efeaf8759ae3c51dc

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on meis-01/fastmri_tools

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

File details

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

File metadata

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

File hashes

Hashes for fastmri_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5d4dd57b3e895df439023744313c388fe1674acbf5994920836046e222d194b
MD5 f4d3cafe131c609db230551755c3480e
BLAKE2b-256 124c2ab5a072702450db84c7fc0639d33fba7a876067c998a6de728c70c6483a

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on meis-01/fastmri_tools

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