Skip to main content

snmf_unmix_lite

Function snmf_unmix_lite 

Source
pub fn snmf_unmix_lite(
    rgb: &[u8],
    basis: &StainBasis,
    iters: u32,
    out_conc: &mut [f32],
) -> Result<usize, HistoError>
Expand description

Unmix packed RGB into non-negative concentrations via multiplicative updates.

  • rgb: packed RGB8, n pixels
  • basis: 2 or 3 stain vectors in OD space
  • iters: multiplicative update iterations (typical 20–50 for lite)
  • out_conc: row-major [pixel][stain], length ≥ n * k

Initializes concentrations from a non-negative least projection, then refines with C ← C ⊙ (Sᵀ Y) / (Sᵀ S C + ε) per pixel (independent MU — patch-local lite).