pub fn run_dipole_inversion(
field_ppm: &[f64],
mask: &[u8],
metadata: &ScanMetadata,
config: &InversionConfig,
magnitude: Option<&[f64]>,
progress: &mut dyn FnMut(usize, usize),
) -> Result<Vec<f64>, PipelineError>Expand description
Run a dipole inversion on the field its method takes.
Which field that is comes from InversionConfig::input:
InversionInput::LocalField(most methods): the local field after background removal, with the eroded mask background removal returned.InversionInput::TotalField: the total field straight from field mapping, with the brain mask and no background removal. Through this function that is TFI, AutoQSM and NeXtQSM. TFI solves over the whole FOV under its preconditioner (1 insidemask,precondoutside) and weights the data by the magnitude inside the mask, so the total field and the brain mask are exactly what it needs; given a local field and an eroded mask it would run, but would be solving a different problem.InversionInput::WrappedPhasemethods, and TGV and QSMART, have their own entry points and are refused here.
Handles MEDI’s unit conversion (ppm → radians) internally.
§Arguments
field_ppm- The local or total field in ppm, as abovemask- The eroded mask from background removal (local field), or the brain mask (total field)metadata- Scan metadataconfig- Inversion configurationmagnitude- Combined magnitude image; MEDI, TFI and HD-QSM instead require the magnitude of every echo, stacked with the echo slowestprogress- Progress callback (current_iter, max_iter)
§Returns
Susceptibility map in ppm (unreferenced)