pub fn phase_offset_removal(
phases: &[impl AsRef<[f64]>],
mags: &[impl AsRef<[f64]>],
tes: &[f64],
mask: &[u8],
sigma: [f64; 3],
echoes: [usize; 2],
unwrap_method: UnwrapMethod,
grid: &Grid,
) -> (Vec<Vec<f64>>, Vec<f64>)Expand description
MCPC-3D-S phase offset estimation for single-coil multi-echo data
Implements the MCPC-3D-S algorithm from MriResearchTools.jl for single-coil data. This estimates and removes the phase offset (φ₀) from each echo.
§Arguments
phases- Phase data for all echoes, shape [n_echoes][nxnynz]mags- Magnitude data for all echoes, shape [n_echoes][nxnynz]tes- Echo times in msmask- Binary masksigma- Smoothing sigma in voxels [sx, sy, sz], default [10, 10, 5]echoes- Which echoes to use for HIP calculation, default [0, 1] (first two)nx,ny,nz- Dimensions
§Returns
(corrected_phases, phase_offset) where:
- corrected_phases: phases with offset removed
- phase_offset: estimated phase offset Remove phase offset from multi-echo phase data using HIP (Hermitian Inner Product).
Estimates the spatially-varying phase offset from the phase difference between two echoes, smooths it with a Gaussian filter, and subtracts it from all echoes.
§Arguments
phases- Wrapped phase per echo (n_echoes arrays of nxnynz)mags- Magnitude per echotes- Echo times (any consistent unit)mask- Binary masksigma- Gaussian smoothing sigma in voxels [x, y, z]echoes- Which two echoes to use for HIP [e1, e2]unwrap_method- Method to unwrap the HIP phase (Romeo or Laplacian)grid- Volume grid (dimensions and voxel sizes)
§Returns
(corrected_phases, phase_offset) — offset-corrected phases and the estimated offset