Skip to main content

run_qsmart

Function run_qsmart 

Source
pub fn run_qsmart(
    field_ppm: &[f64],
    mask: &[u8],
    reliability: Option<&[u8]>,
    magnitude: Option<&[f64]>,
    metadata: &ScanMetadata,
    inversion_config: &InversionConfig,
    reference: QsmReference,
    observer: &mut dyn Observer,
) -> Result<Vec<f64>, PipelineError>
Expand description

Run QSMART two-stage QSM reconstruction.

§Arguments

  • field_ppm - Total field in ppm (after field mapping)
  • mask - Binary brain mask
  • reliability - QSMART’s reliability map R_0 (1 = reliable), from its echo fit (qsmart_echofit). Both stages run on mask × R_0, as QSMART.m does; vasculature detection uses mask alone. None means every voxel is reliable.
  • magnitude - Combined magnitude (for vasculature detection and, when the inner inversion is MEDI, edge weighting; uniform if None)
  • metadata - Scan metadata
  • inversion_config - Inversion configuration. QSMART-specific settings (SDF, vasculature, iLSQR iteration cap and padding) come from inversion_config.qsmart; the inner dipole inversion algorithm is selected by inversion_config.qsmart.inversion and tuned via the matching per-algorithm field on this config. With the default iLSQR, the inversion is STI Suite’s ilsqr with QSMART’s arguments (qsmart.ilsqr_max_iter, qsmart.ilsqr_pad_mm; the artefact tolerance comes from inversion_config.ilsqr).
  • reference - QSM referencing method
  • observer - Receives progress (step of 6) and the intermediates named in outputs as they are produced, as borrowed slices. A plain FnMut(usize, usize) progress closure works here too and ignores the intermediates.

§Returns

Susceptibility map in ppm (referenced): the stage-1 and stage-2 χ combined by offset adjustment, zero outside the brain mask.