Skip to main content

Module qsmgan

Module qsmgan 

Source
Expand description

QSMGAN dipole inversion (onnx feature).

QSMGAN (Chen 2020) inverts the dipole with a 3D U-Net generator refined by a Wasserstein GAN. Inference is patch-based with an increased receptive field: a 64³ local-field patch maps to a 48³ susceptibility patch (a centre crop baked into the exported graph — the “i64o48” scheme). The network itself is the only part in ONNX; this glue reproduces the authors’ recon.py pipeline:

  • sign flip — the QSM-CI runner negates the local field before the net;
  • tile by non-overlapping 48³ output patches, each fed a 64³ input patch (same centre, 8-voxel context margin, zero-padded at the volume edges);
  • input_scale = 100; output head tanh, so χ = atanh(clip(out)) / 10;
  • mask the result.

The input is the SEPIA-style local field in ppm (already background-removed). Weights are not bundled; the caller passes the exported qsmgan.onnx bytes.

Constants§

INPUT_SCALE 🔒
IPS 🔒
OPS 🔒
OUTPUT_SCALE 🔒

Functions§

qsmgan
Run QSMGAN on a background-removed local field (ppm), column-major (nx,ny,nz). Returns susceptibility (ppm), masked, in the same layout.