Skip to main content

medi_l1

Function medi_l1 

Source
pub fn medi_l1(
    local_field: &[f64],
    n_std: &[f64],
    magnitude: &[f64],
    mask: &[u8],
    nx: usize,
    ny: usize,
    nz: usize,
    vsx: f64,
    vsy: f64,
    vsz: f64,
    lambda: f64,
    bdir: (f64, f64, f64),
    merit: bool,
    smv: bool,
    smv_radius: f64,
    data_weighting: i32,
    percentage: f64,
    cg_tol: f64,
    cg_max_iter: usize,
    max_iter: usize,
    tol: f64,
) -> Vec<f64>
Expand description

MEDI L1 dipole inversion with full options (OPTIMIZED f32 VERSION)

§Arguments

  • local_field - Local field/phase (RDF) in radians (nx * ny * nz)
  • n_std - Noise standard deviation map (same size as local_field)
  • magnitude - Magnitude image for gradient weighting (nx * ny * nz)
  • mask - Binary mask (nx * ny * nz), 1 = brain
  • nx, ny, nz - Array dimensions
  • vsx, vsy, vsz - Voxel sizes in mm
  • lambda - Regularization parameter (default: 7.5e-5, matching MATLAB MEDI)
  • bdir - B0 field direction (default: (0, 0, 1))
  • merit - Enable iterative merit-based outlier adjustment (default: false)
  • smv - Enable SMV preprocessing within MEDI (default: false)
  • smv_radius - SMV radius in mm (default: 5.0)
  • data_weighting - Data weighting mode: 0=uniform, 1=SNR (default: 1)
  • percentage - Fraction of voxels considered edges (default: 0.3 = 30%, matching MATLAB gpct=30)
  • cg_tol - CG solver tolerance (default: 0.01)
  • cg_max_iter - CG maximum iterations (default: 10, matching MATLAB)
  • max_iter - Maximum Gauss-Newton iterations (default: 30, matching MATLAB)
  • tol - Convergence tolerance (default: 0.1)

§Returns

Susceptibility map (in same units as input field)