Skip to main content

slice_chopping_coherence

Function slice_chopping_coherence 

Source
pub fn slice_chopping_coherence(
    real: &[&[f64]],
    imag: &[&[f64]],
    grid: &Grid,
) -> [f64; 3]
Expand description

Magnitude-weighted neighbour coherence along each axis, pooled over echoes.

For each axis this is Re Σ z_v z̄_{v+1} / Σ |z_v| |z_{v+1}| over neighbouring pairs that both lie in the signal mask, summed over echoes: the magnitude-weighted mean of cos Δφ between neighbours. Weighting by magnitude lets the high-signal echoes and voxels dominate, which is where the neighbour phase difference is small and the sign of the result unambiguous.

The mask is an Otsu threshold on the first echo’s magnitude, so background noise (whose neighbour phase differences are uniform and average to zero, diluting the result) does not count. If nothing clears it, every voxel counts.

§Panics

If there are no echoes, real and imag hold different numbers of echoes, or a volume does not have grid.n_total() voxels.