pub fn multi_echo_linear_fit(
unwrapped_phases: &[impl AsRef<[f64]>],
mags: &[impl AsRef<[f64]>],
tes: &[f64],
mask: &[u8],
estimate_offset: bool,
reliability_threshold_percentile: f64,
) -> LinearFitResultExpand description
Multi-echo linear fit with magnitude weighting
Fits a linear model: phase = slope * TE + intercept using weighted least squares with magnitude as weights.
Based on QSM.jl multi_echo_linear_fit and QSMART echofit.m
§Arguments
unwrapped_phases- Unwrapped phase for each echo [n_echoes][nxnynz]mags- Magnitude for each echo [n_echoes][nxnynz]tes- Echo times in secondsmask- Binary maskestimate_offset- If true, estimate phase offset (intercept)reliability_threshold_percentile- Percentile for reliability masking (0-100, 0=disable)
§Returns
LinearFitResult containing field, phase_offset, fit_residual, reliability_mask