Skip to main content

harperella

Function harperella 

Source
pub fn harperella(
    input: HarperellaInput<'_>,
    mask: &[u8],
    grid: &Grid,
    params: &HarperellaParams,
    progress: impl FnMut(usize, usize),
) -> Result<(Vec<f64>, Vec<u8>), InputError>
Expand description

HARPERELLA: the exterior Laplacian makes the SMV of the total Laplacian uniform.

Solves the paper’s Eq. 3, min ‖S(∇²φ_E) + S(∇²φ_{I+O}) − δ‖₂ over the field of view, for the Laplacian ∇²φ_E outside the brain, where S is the spherical mean of radius mm and δ (Eq. 4) is the mean of S(∇²φ) over the trustable interior I. The paper splits the tissue into I and the boundary region O, “the set of tissue voxels next to the boundaries that are within a distance of the radius of the spherical mean value filter”, so I is the mask eroded by radius. The local field is the inverse Laplacian of the brain’s Laplacian plus the exterior one (Eqs. 5-6).

STI Suite 3.0 does not include HARPERELLA, so where the paper is silent this uses what STI’s iHARPERELLA does (module docs): the spectral Laplacian and its inverse (the paper’s Eq. 6 is the same inverse), the boundary rim and its 20 % of large values set to zero (the paper: “large Laplacian values near the boundary of the brain (<3 voxels from the boundary)”), MATLAB lsqr at tolerance 0.001 (the paper: “the preconditioned LSQR method”, preconditioner unstated), and no padding by default (the paper pads, size unstated).

§Arguments

  • input - Wrapped phase (rad) or unwrapped total field (ppm); see HarperellaInput
  • mask - Binary brain mask (nx * ny * nz), 1 = inside
  • grid - Volume dimensions and voxel sizes
  • params - Algorithm parameters
  • progress - Progress callback (iteration, max_iter)

§Returns

(local_field_ppm, mask): the background-free local field in ppm, and the brain mask.

§Errors

A buffer whose length does not match grid, or a WrappedPhase echo time or field strength that is not positive.