pub fn scanner_masked_phase(phases: &[&[f64]]) -> ScannerMaskedPhaseExpand description
Find the voxels where the scanner wrote no phase: a constant fill value, the same in every echo, covering a large part of the volume.
Some scanners mask the phase they export. Philips writes the lowest phase value (−π once
scaled) outside its own signal mask, in every echo, with magnitude 0 or noise; on the Philips
series of the Q0748 audit (2026-11) that was 56–67 % of the field of view. A phase that is flat
in space and constant over echoes looks like the most reliable phase there is: ROMEO’s phase
quality (and ROMEO.jl’s voxelquality) rates it far above the brain, so a phase-quality mask
takes the background in (27–50 % of the default mask’s voxels on those series), and MCPC-3D-S
and the unwrapper treat it as signal.
A voxel has no data when its phase is bit-identical in every echo and equal to the
volume’s most frequent exact value, provided that value covers at least
SCANNER_FILL_MIN_FRACTION of the volume. With one echo only the second condition applies.
Both conditions are needed: with two echoes of a 12-bit phase, about 1 in 4,096 real voxels
repeats its value by chance, and a mode alone could be a genuine (if implausible) phase.
Measured phase never meets both, so this is not a threshold on the data, only the detection
of a value the scanner wrote; when no value qualifies, every voxel has data.
phases holds each echo’s phase, in any units (the comparison is exact).