pub fn complex_to_mag_phase(
real: &[&[f64]],
imag: &[&[f64]],
grid: &Grid,
params: &ComplexToMagPhaseParams,
) -> MagPhaseEchoesExpand description
Convert multi-echo real/imaginary volumes to magnitude and phase, correcting alternate-slice π chopping.
With ChopCorrection::Auto an axis is corrected when its
slice_chopping_coherence is negative, i.e. neighbours along it are, on balance, closer
to anti-phase than in-phase. One decision covers all echoes. Check
SliceChopping::ambiguous_axes on the result for axes where that decision was close.
The correction negates z on odd-indexed planes along each corrected axis before taking
arg z; magnitude is unchanged by it. With negate_phase the phase is arg z̄ instead,
which leaves the chop detection unchanged. Non-finite inputs are treated as zero.