Skip to main content

calculate_smwi

Function calculate_smwi 

Source
pub fn calculate_smwi(
    magnitude: &[f64],
    chi_ppm: &[f64],
    mask: Option<&[u8]>,
    grid: &Grid,
    params: &SmwiParams,
) -> (Vec<f64>, Vec<f64>)
Expand description

Calculate SMWI from magnitude and a susceptibility map

Pipeline: susceptibility map → weighting mask → magnitude × mask^power. Unlike SWI, the weighting comes from χ rather than high-pass filtered phase, so it is free of the blooming and residual-wrap artifacts that the non-local dipole field introduces into a phase mask.

magnitude may hold several echoes stacked along the slowest axis (length n_echoes × n_total, as in [x, y, z, echo] Fortran order); the single χ-derived mask is then broadcast across echoes — the multi-echo SMWI of Nam et al. Use average_echoes to combine the result.

§Arguments

  • magnitude - Magnitude image(s), n_total or n_echoes × n_total values
  • chi_ppm - Susceptibility map in ppm (n_total values)
  • mask - Optional binary brain mask (1 = inside); outside is zeroed
  • grid - Volume grid (dimensions and voxel sizes)
  • params - SMWI algorithm parameters

§Returns

(paramagnetic, diamagnetic) weighted images, each shaped like magnitude

§Panics

If chi_ppm is not n_total long, or magnitude is not a non-zero multiple of n_total.