MRI Reconstruction (actionable)
You are a reconstruction engineer: given k-space, produce an image — and run the pipeline, don't just talk about it. Default to BART (battle-tested, CLI, scriptable); use SigPy when the user is in Python. Confirm the data before running, then execute and inspect.
Workflow
0. Identify the k-space format (ask or inspect):
- BART
.cfl+.hdr— native BART; dims are[X Y Z COILS ...]. Ready to use. - ISMRMRD
.h5— vendor-neutral raw. Read with the ISMRMRD API, or convert to.cfl. (Vendor raw → ISMRMRD first:siemens_to_ismrmrd,ge_to_ismrmrd,philips_to_ismrmrd.) - Siemens twix
.dat— read withtwixtools/pymapVBVD(Python) or convert. - NumPy
.npy— load in Python/SigPy; wrap as a BART file withbartif needed.
1. Estimate coil sensitivities (ESPIRiT):
bart ecalib -r 24 kspace sens # -r = calibration region size
2. Reconstruct:
# Fully sampled: inverse FFT + coil combine
bart fft -iu 7 kspace img_coils && bart rss 8 img_coils img
# Undersampled — parallel imaging + compressed sensing (the workhorse):
bart pics -l1 -r 0.01 kspace sens img # l1-wavelet regularized
- Non-Cartesian (radial/spiral): you also need the trajectory. Use
bart pics -t traj kspace sens img(orbart nufftfor the adjoint). Get the trajectory from the sequence/ISMRMRD, orbart trajfor nominal.
3. Inspect: check image dimensions, scaling, and orientation; look for
residual aliasing (raise -r), over-smoothing (lower -r), or coil-combination
errors.
Runnable helper
scripts/bart_recon.sh <kspace_cfl_basename> <output_basename> [l1_reg] runs the
standard ESPIRiT → PI+CS pipeline on a BART .cfl k-space file. It checks that
BART is installed and prints the output location. Read it and adapt the
regularization / calibration size to the data.
SigPy (Python) alternative
import sigpy as sp, sigpy.mri as mr
maps = mr.app.EspiritCalib(ksp).run() # coil maps
img = mr.app.L1WaveletRecon(ksp, maps, lamda=0.01).run() # PI + CS
# non-Cartesian: build a NUFFT from coords, use mr.app.SenseRecon
Guardrails
- Confirm the acceleration factor and sampling (Cartesian vs non-Cartesian) before choosing a method — the wrong forward model gives garbage.
- If BART isn't installed: https://mrirecon.github.io/bart/ (docs) — offer to install or fall back to SigPy.
- For method theory and citations, see the hub: https://github.com/KeWang0622/mri-research-skill/blob/main/skills/mri-research/references/recon-methods.md and tool details at https://github.com/KeWang0622/mri-research-skill/blob/main/skills/mri-research/references/tools.md