Skip to main content

vsharp

Function vsharp 

Source
pub fn vsharp(
    field: &[f64],
    mask: &[u8],
    grid: &Grid,
    params: &VsharpParams,
    progress: impl FnMut(usize, usize),
) -> Result<(Vec<f64>, Vec<u8>), InputError>
Expand description

V-SHARP background field removal

Uses multiple SMV kernel radii, starting from largest and decreasing. At each voxel, uses the largest radius whose ball fits inside the mask, then (if params.deconvolve) deconvolves by the largest kernel.

§Arguments

  • field - Unwrapped total field (nx * ny * nz)
  • mask - Binary mask (nx * ny * nz), 1 = inside ROI
  • grid - Volume dimensions and voxel sizes
  • params - V-SHARP parameters (min/max radius in mm, deconvolution on/off and its threshold, working grid)
  • progress - Progress callback (radius_index, total_radii)

§Returns

(local_field, eroded_mask)

§Errors

If VsharpParams::validate rejects params.