Skip to main content

calculate_swi

Function calculate_swi 

Source
pub fn calculate_swi<P: AsRef<[f64]> + Sync, M: AsRef<[f64]> + Sync>(
    phases: &[P],
    mags: &[M],
    tes: &[f64],
    mask: Option<&[u8]>,
    grid: &Grid,
    params: &SwiParams,
) -> Result<SwiResult, InputError>
Expand description

CLEAR-SWI from multi-echo (or single-echo) phase and magnitude.

As CLEARSWI.jl’s calculateSWI(Data(mag, phase, header, TEs), options). See the module docs for the steps.

§Arguments

  • phases - Wrapped phase, one volume per echo, in radians
  • mags - Magnitude, one volume per echo
  • tes - Echo times, one per echo (seconds; only their ratios and the weighting use them)
  • mask - Mask the phase is filtered and scaled within. None uses CLEAR-SWI’s own: [robust_mask] of the first echo’s magnitude, which covers the head
  • grid - Volume grid (dimensions and voxel sizes)
  • params - CLEAR-SWI parameters

§Errors

If there are no echoes, the phase, magnitude and echo-time counts differ, an echo time is not positive and finite (several echoes only), or a volume does not match grid.