Expand description
QSMnet deep-learning dipole inversion (onnx feature).
QSMnet is a 3D U-Net (SNU-LIST) that maps a local field (ppm) to
susceptibility (ppm). The upstream weights are TensorFlow, but we ship a
clean PyTorch re-export (scripts/onnx-export/export_qsmnet.py): the plain
U-Net rebuilt in PyTorch with the TF weights ported in, giving a tidy NCDHW
ONNX ([1, 1, X, Y, Z]) that the pure-Rust tract engine runs — unlike the
tf2onnx graph, whose NHWC↔NCHW Reshape/Transpose ops tract can’t analyse.
This mirrors the authors’ inference (Code/inference.py): normalize by the
dataset mean/std shipped with the checkpoint, centered zero-pad each dim to a
multiple of 16 (four pool/deconv levels), run, crop, de-normalize, and mask.
Weights are not bundled; the caller passes the exported qsmnet.onnx bytes
(see crate::models).
Structs§
- Qsmnet
Norm - Dataset normalization constants stored beside a QSMnet checkpoint
(
norm_factor_<name>.mat):field_n = (field - in_mean)/in_std, andchi = out_std*pred + out_mean.
Functions§
- qsmnet
- Run QSMnet dipole inversion.
- qsmnet_
tiled - Memory-bounded QSMnet via overlap-tiling — the fully-convolutional U-Net run patch-by-patch
(for 32-bit WASM, where whole-volume
qsmnetoverflows the heap on clinical data). The dataset normalization is applied per value inside the tile loop and the net’s pool depth requires a/16patch. Approximates whole-volume up to tile-boundary error; seecrate::inversion::tiled.