Skip to main content

arlo

Function arlo 

Source
pub fn arlo(
    magnitude: &[f64],
    echo_times: &[f64],
    n_voxels: usize,
) -> Result<Vec<f64>, InputError>
Expand description

R2* by ARLO: arlo.m (MEDI toolbox 2024.11.26), line for line.

Over each consecutive echo triplet j, j+1, j+2, y is arlo.m’s integral of the signal (Simpson’s rule for even spacing, its general form otherwise) and x = s_j − s_{j+2}; then R2* = (Σ y·x + Σ β·x²) / (Σ β·y·x + Σ y²). Echo spacing may be uneven. Every voxel is fitted, with no upper clip and no fallback, and NaN or infinite results are 0, as in arlo.m.

Deviations from arlo.m:

  • Negative estimates (noise-only or rising-signal voxels) are set to 0: a negative decay rate has no physical meaning, and QSM.rs does not output negative relaxation rates. Every non-negative estimate is arlo.m’s value unchanged. (MEDI’s extract_CSF thresholds R2* at 5 Hz, so its CSF mask is the same either way.)
  • arlo.m returns [] for one echo and 0 everywhere for two (no triplet); this returns an error for fewer than three echoes, and for echo times that are not finite and strictly increasing (where arlo.m divides by zero or fits the wrong order).

§Arguments

  • magnitude - The echo magnitudes, echo_times.len() volumes of n_voxels stacked with the echo slowest (the order of a 4D NIfTI)
  • echo_times - Echo times in seconds
  • n_voxels - Voxels per echo

§Returns

R2* in Hz per voxel

§Errors

See arlo_echo_times_problem; also a magnitude whose length is not n_voxels * echo_times.len().