Skip to main content

Module qsmnetme

Module qsmnetme 

Source
Expand description

QSMnetME deep-learning dipole inversion (onnx feature).

QSMnetME is the QSM network of the SNU-LIST χ-separation toolbox v1.1.3 (models/240904_QSMnet.onnx): a QSMnet-style 3D U-Net (Conv/ReLU/MaxPool/ConvTranspose/Concat, 1 channel in and out) trained on multi-echo data (Kim et al. 2025, χ-sepnet, §2.2.2), which the toolbox runs to make χ-sepnet’s QSM channel. It is not the QSMnet of Yoon et al. 2018 ([super::qsmnet]): its own weights, normalisation and input route. The hosted qsmnetme.onnx is the toolbox’s graph with its fixed 192×192×128 input re-declared dynamic (scripts/onnx-export/redeclare_dynamic_axes.py; weights and nodes untouched, identical output at the declared shape).

§The authors’ route

The toolbox never runs QSMnetME on its own. It runs it inside chi_sepnet_general (Chisep_script.m:194), which was probed as a black box in licensed MATLAB R2023b (QSM.rs#377; method and the resampling in [crate::utils::chisep_frame]). The QSM channel there is:

  1. the local field (Hz) resampled into the training frame (B0 along the third axis, 1 mm, padded to multiples of 16) with interp3 'spline', the mask with 'linear' > 0.5;
  2. converted to ppm with the central frequency (field_hz / (CF·1e-6)), z-scored with the field statistics of the χ-sepnet normalisation file (xsepnet_train_patch_norm_factor_inplane_largedegree_romeo_arlo.mat: field_mean, field_std), and set to 0 outside the frame mask;
  3. one pass of the network over the whole frame volume (no tiling);
  4. de-normalised with the COSMOS susceptibility statistics of the same file (cosmos_sus_std·y + cosmos_sus_mean), and set to 0 outside the frame mask.

Every constant and step was read off the toolbox’s workspaces: the network input matched (field/(CF·1e-6) − field_mean)/field_std inside the mask to 7.7e-7 (float32 rounding) and 0 outside, and the QSM matched cosmos_sus_std·y + cosmos_sus_mean exactly.

qsmnetme takes the local field in ppm, as every inversion in this crate does, so step 2’s conversion is the identity. It then does what the toolbox does to the maps it returns: resample the frame QSM back onto the acquired grid (interp3 'spline', see [crate::utils::chisep_frame]) and mask it. That last step is the toolbox’s treatment of χ-sepnet’s χ+ and χ−, applied here to the QSM, which the toolbox keeps internal; the QSM is signed, so nothing is clipped.

§Agreement with the original

The toolbox’s QSM channel (MATLAB R2023b, chi_sepnet_general with the network computed by ONNX Runtime) against the Python reproduction QSM-CI’s qsmnetme entry runs (algorithms/qsmnetme/recon.py): 1.7e-5 % NRMSE on 64×60×48 at 0.8×0.9×1.1 mm with B0 along (0.1, 0.2, 0.97), 1.9e-5 % at 1 mm with B0 along z (float32 rounding, ONNX Runtime’s thread count). tests/models_onnx/dipole.rs checks qsmnetme against that entry on the in-vivo box (tests/data/dl_snu_route_small.py).

§Memory

The authors run the whole frame in one pass. For a 1 mm head that is ~192×224×176 voxels with 64 channels at full resolution: about 1.1 GB per activation. QsmnetmeParams::patch runs an overlapping sliding window instead (a smaller result near patch seams: not the authors’), for hosts that cannot hold that.

Reference: Kim, M., …, Shin, H.-G., Lee, J. (2025). “χ-sepnet: Deep neural network for magnetic susceptibility source separation.” Human Brain Mapping, 46(4):e70136. doi:10.1002/hbm.70136.

Structs§

QsmnetmeNorm
QSMnetME’s normalisation: (mean, std) of the field (ppm) input and the χ (ppm) output, from xsepnet_train_patch_norm_factor_inplane_largedegree_romeo_arlo.mat (field_*, cosmos_sus_*; the same values χ-sepnet’s ChiSepNetNorm uses for its field and QSM channels).
QsmnetmeParams
Inference parameters for qsmnetme.

Functions§

qsmnetme
Run QSMnetME dipole inversion by the authors’ route (module docs).
qsmnetme_in_frame 🔒
QSMnetME in the training frame (steps 2-4 of the module docs, ppm in): the frame QSM (ppm, masked) and the z-scored field channel, which χ-sepnet takes too.