fn field_mapping_with_offset(
phases: &[&[f64]],
mag_slices: &[&[f64]],
mask: &[u8],
metadata: &ScanMetadata,
config: &FieldMappingConfig,
_n_voxels: usize,
nx: usize,
ny: usize,
nz: usize,
vsx: f64,
vsy: f64,
vsz: f64,
progress: &mut dyn FnMut(usize, usize),
) -> Result<FieldMappingResult, PipelineError>Expand description
Path A: Multi-echo with phase offset removal.
MCPC-3D-S (crate::utils::phase_offset_removal) leaves the phase NaN where its offset is
undefined, as MriResearchTools does. ROMEO is given that NaN phase and the brain mask, exactly
as ROMEO.jl is in the authors’ pipeline, so it never grows through those voxels. The other
unwrappers (QSM.rs’s options here) take no NaN: they get the phase zeroed there and the mask
brain ∩ valid. The echoes are combined inside brain ∩ valid, the field is 0 outside it, and
that mask is returned as FieldMappingResult::valid_mask.