Skip to main content

field_mapping_complex_fit

Function field_mapping_complex_fit 

Source
fn field_mapping_complex_fit(
    phases: &[&[f64]],
    magnitudes: Option<&[&[f64]]>,
    mask: &[u8],
    metadata: &ScanMetadata,
    config: &FieldMappingConfig,
    params: &FitPpmComplexParams,
    progress: &mut dyn FnMut(usize, usize),
) -> Result<FieldMappingResult, PipelineError>
Expand description

B0EstimationMethod::ComplexFit: MEDI’s field map. Fit_ppm_complex on the wrapped complex echoes gives the phase per echo spacing, wrapped; it is unwrapped spatially, as MEDI’s iFreq = unwrapPhase(iMag, iFreq_raw, matrix_size) does, and divided by the echo spacing. The noise map (dp1, MEDI’s N_std) is converted the same way, to ppm. The fit itself is returned too (FieldMappingResult::complex_fit: iFreq_raw and N_std in MEDI’s units).

The configured unwrapping_algorithm unwraps it. UnwrappingAlgorithm::MediRegionGrowing is MEDI’s own unwrapPhase(iMag, iFreq_raw, matrix_size), with iMag the root-sum-of-squares of the echo magnitudes and no mask, so with it this is MEDI’s field map (QSM-CI’s fit-ppm-complex-cornell; tests/medi_unwrap_cornell_parity.rs). ROMEO gets the same iMag as its magnitude. Laplacian unwrapping is done as on the other paths: phase zeroed outside the mask first, masked mean removed after (it leaves a constant undetermined).