Skip to main content

Module iqsm

Module iqsm 

Source
Expand description

iQSM single-step deep-learning reconstruction (onnx feature).

iQSM (Gao 2022) maps raw wrapped MRI phase (radians) directly to susceptibility (ppm) — unwrapping, background removal and dipole inversion in one network (a learnable-Laplacian “LoT” front-end + a U-Net). The exported graph takes four inputs: phase, mask, te (s, scalar), b0 (T, scalar).

This mirrors the authors’ inference.run_iqsm: flip the phase sign, erode the mask by a radius-3 sphere, centre-pad each dim to a multiple of 16, run the net, multiply by the (padded) mask, and crop back. For multi-echo data each echo is reconstructed and combined with magnitude·TE² weighting (iqsm_multi_echo).

Weights are not bundled; the caller passes the exported iqsm.onnx bytes.

Functions§

iqsm
Run iQSM on a single echo of wrapped phase.
iqsm_multi_echo
Multi-echo iQSM: reconstruct each echo and combine with magnitude·TE² weights (the authors’ --echo_4d path). phases/magnitudes are per-echo volumes; tes the echo times (s). Falls back to uniform weights if magnitudes is empty.
iqsm_with 🔒
sphere_erode 🔒
Binary erosion by a solid sphere of the given radius (voxels), matching scipy.ndimage.binary_erosion with border_value=0 (out-of-bounds = false).