Expand description
Dipole inversion stage
Dispatcher for standard dipole inversion algorithms. Also contains TGV and QSMART pipeline runners which combine multiple stages internally.
MEDI Hz↔radians conversion is handled internally — the caller passes ppm fields and receives ppm results.
Constants§
- IQSM_
ERODED_ 🔒RAD - IQSM_
PHASE_ 🔒SIGN - The authors’ fixed inference conventions for the iQSM/iQFM LoT-Unet family:
phase sign
-1and a 3-voxel mask-erosion radius. These are training-time constants, not user knobs, so the pipeline runners bake them in.
Functions§
- echo_
magnitudes 🔒 - The echo magnitudes a MEDI-toolbox method requires (MEDI’s edge mask, and the
Fit_ppm_complexnoise map that MEDI and PDF weight the data by): one volume per echo, echo slowest, for evenly spaced echoes (asFit_ppm_complex.massumes).methodnames the method in the error messages. - heidi_
params 🔒 - HEIDI’s parameters with the scan’s: NESTA’s result depends on χ’s scale in upstream’s phase
units (see the HEIDI module docs), so the field strength and echo times come from metadata,
and
config.heidi.tepicks the echo time of the field (by default the last, as qsm_heidi’s phase2susceptibilityfactor uses). - heidi_
seed_ problem - Why HEIDI’s cone fill cannot follow
config’s inversion, if it cannot (Nonewhen HEIDI is off or the seed is allowed). The hard errors ofrun_heidi_cone_fill, for hosts to check at plan time: - invert 🔒
run_dipole_inversionwithout HEIDI’s cone fill after a non-LSQR seed.- run_
autoqsm 🔒 - Source the AutoQSM weights and run inference (requires the
onnxfeature).fieldis the total field (AutoQSM does its own background removal). - run_
dipole_ inversion - Run a dipole inversion on the field its method takes.
- run_
heidi_ cone_ fill - HEIDI’s cone fill on a seed χ map: streaking reduction after
config’s inversion (crate::inversion::heidi_cone_fill).run_dipole_inversioncalls it whenInversionConfig::cone_fill_afterholds; a host that combines several inversions (two-pass) runs them withapply_heidioff and calls this once on the combined map, for any seed. - run_
iqfm - Run iQFM: joint unwrapping + background removal from wrapped phase in one
network (the tissue-field head of the iQSM LoT-Unet). Returns the local
(background-removed) field in ppm — feed it to any dipole inversion. This is a
deep-learning replacement for the unwrap + BFR stages, not an inversion. Multi-echo
inputs are combined with
echo_weighting, as inrun_iqsm. Requires theonnxfeature +iqfmweights. - run_
iqsm - Run iQSM single-step reconstruction from wrapped phase (joint unwrap +
background removal + dipole inversion). Multi-echo inputs are reconstructed
per echo and combined with
echo_weighting(default (magnitude·TE)², the inverse-variance weight; seeIqsmEchoWeighting). Requires theonnxfeature +iqsmweights. - run_
iqsm_ plus - Run iQSM+ single-step reconstruction from wrapped phase (orientation-adaptive
variant; the B0 direction is a genuine network input). See
run_iqsm; the echoes are combined with (magnitude·TE)² weights, as in both of the authors’ implementations. - run_
ir2qsm 🔒 - Source the IR2QSM weights and run inference (requires the
onnxfeature). - run_
lpcnn 🔒 - Source the LPCNN proximal-CNN weights and run inference (requires the
onnxfeature). LPCNN’s k-space data-consistency step uses the B0 direction. - run_
modl_ 🔒qsm - Source the MoDL-QSM prior-CNN weights and run inference (requires the
onnxfeature). Output is the STI χ33 component. - run_
nextqsm - Run NeXtQSM end-to-end from the total field (it does its own background removal), sourcing both weight files from the registry.
- run_
qsmgan 🔒 - Source the QSMGAN generator weights and run inference (requires the
onnxfeature). - run_
qsmnet 🔒 - Source a QSMnet-family model’s weights and run inference (requires the
onnxfeature).model_idselects the registry entry (qsmnet/qsmnet-plus),normsupplies that checkpoint’s normalization constants. - run_
qsmnetme 🔒 - Source the QSMnetME weights and run it by the authors’ route (requires the
onnxfeature).tile(the deep-learning inversions’(core, halo)) turns the toolbox’s whole-volume pass into a sliding window ofcore + 2·halorounded up to a multiple of 16, for memory-limited hosts. - run_tgv
- Run TGV single-step QSM reconstruction.
- run_
xqsm 🔒 - Source the xQSM weights and run inference. Requires the
onnxfeature; weights resolve throughcrate::models(bytes supplied withcrate::models::provide_weights, then$QSM_MODEL_DIR/cache/download on native). - scan_
echo_ 🔒times - The scan’s echo times for a method that converts ppm to radians at the echo time its
techoice picks, checked here so the method itself does not panic on them.