pub fn decompose(
chi_total: &[f64],
magnitude: &[f64],
echo_times: &[f64],
mask: &[u8],
params: &DecomposeParams,
progress: impl FnMut(usize, usize),
) -> (Vec<f64>, Vec<f64>, Vec<f64>)Expand description
DECOMPOSE source separation from a provided QSM and multi-echo magnitude.
§Arguments
chi_total— Conventional QSM χ_total in ppm (n_voxels), used to synthesize the per-echo phase.magnitude— Multi-echo magnitude, flattened as(n_voxels, n_echoes)in row-major order (echo fastest per voxel) — the same layout ascrate::separation::r2star_qsm_from_magnitude. Normalised internally by its global maximum.echo_times— Echo times in seconds (n_echoes).mask— Binary brain mask (n_voxels, 1 = inside).params— SeeDecomposeParams.progress— Progress callback(voxels_done, voxels_total), called periodically over the fitted (masked) voxels.
§Returns
(chi_pos, chi_neg, chi_total) in ppm, restricted to mask — matching the
chi_sep_ilsqr/chi_sep_medi
convention: chi_pos ≥ 0 (paramagnetic), chi_neg ≤ 0 (diamagnetic, signed),
and chi_total = chi_pos + chi_neg.