Skip to main content

unwrap_prelude

Function unwrap_prelude 

Source
pub fn unwrap_prelude(
    phase: &[f64],
    mask: &[u8],
    grid: &Grid,
    params: &PreludeParams,
) -> Vec<f64>
Expand description

Unwrap a 3D phase volume with PRELUDE’s region-merging algorithm.

§Arguments

  • phase — wrapped phase in radians, nx * ny * nz, expected in [-π, π]
  • mask — binary mask, non-zero to process
  • grid — volume dimensions (voxel sizes are unused: regions and interfaces are defined on the voxel lattice, not in physical space)
  • params — see PreludeParams

§Returns

Unwrapped phase, same length as phase. Voxels outside the mask are returned unchanged, as are in-mask voxels whose phase is not finite.

Each connected set of regions is unwrapped independently and carries its own arbitrary multiple of 2π; there is no information linking them across a gap in the mask.

§Panics

If phase or mask does not match the grid, if params.num_phase_partitions is zero, or if the volume has more than u32::MAX voxels.