Skip to main content

unwrap_slicewise

Function unwrap_slicewise 

Source
pub fn unwrap_slicewise(
    phase: &[f64],
    mag: &[f64],
    mask: &[u8],
    method: UnwrapMethod,
    params: &SliceWiseParams,
    grid: &Grid,
) -> Vec<f64>
Expand description

Unwrap each slice independently, in plane.

method selects the unwrapper, which runs unchanged on a (d0, d1, 1) grid per slice so the slice axis is never differentiated across. Masked-out voxels keep whatever the chosen unwrapper leaves them: zero for UnwrapMethod::Laplacian, the wrapped input for the region-growing methods.

The result is self-consistent within each slice and determined only up to a multiple of 2π between slices. For multi-echo data use unwrap_slicewise_multi_echo, which makes that multiple echo-independent so a fit across echoes cancels it. See the module docs.

§Arguments

  • phase - Wrapped phase (nx * ny * nz)
  • mag - Magnitude for the weighting of UnwrapMethod::Romeo; may be empty
  • mask - Binary mask (nx * ny * nz), 1 = inside ROI
  • method - Which unwrapper to run on each slice
  • params - Slice axis and the per-method parameters
  • grid - Volume grid

§Panics

If params.slice_axis is not 0, 1 or 2, or if phase/mask do not match grid.