Skip to main content

unwrap_slicewise_multi_echo

Function unwrap_slicewise_multi_echo 

Source
pub fn unwrap_slicewise_multi_echo<P: AsRef<[f64]>, M: AsRef<[f64]>>(
    phases: &[P],
    mags: &[M],
    tes: &[f64],
    mask: &[u8],
    method: UnwrapMethod,
    params: &SliceWiseParams,
    grid: &Grid,
) -> Vec<Vec<f64>>
Expand description

Unwrap each echo slice-wise, then make each slice’s leftover 2π the same across echoes.

Each (slice, echo) is unwrapped independently by unwrap_slicewise and so picks its own multiple of 2π. Left alone, that breaks the one thing that rescues 2D multi-slice data: the slice offset is echo-independent and cancels in a fit across echoes, but only while the leftover 2π is echo-independent too. enforce_inter_echo_consistency makes it so, unless params.enforce_inter_echo_consistency is false.

tes is used only for the phase-gradient-coherence weighting of UnwrapMethod::Romeo, which compares each echo against its neighbour. The consistency correction itself does not use it, and so does not care whether the echoes are evenly spaced.

§Arguments

  • phases - Wrapped phase per echo, each (nx * ny * nz)
  • mags - Magnitude per echo; may be empty
  • tes - Echo times in seconds, one per echo
  • mask - Binary mask (nx * ny * nz), 1 = inside ROI
  • method - Which unwrapper to run on each slice
  • params - Slice axis, per-method parameters, and the consistency switch
  • grid - Volume grid

§Panics

If phases is empty or tes has a different length.