squidpy.experimental.im.StainReference

class squidpy.experimental.im.StainReference(method, stain_matrix=None, mu=None, sigma=None, white_point=None, max_concentrations=None)[source]

Container for a fitted stain reference.

Parameters:
  • method (Literal['macenko', 'vahadane', 'reinhard']) – Fitting method: "macenko", "vahadane", or "reinhard".

  • stain_matrix (ndarray | None) – Shape (3, 3) unit-norm matrix in canonical order (H, E, complement). Required for decomposition methods.

  • mu (ndarray | None) – Shape (3,) Ruderman Lab channel means. Reinhard only.

  • sigma (ndarray | None) – Shape (3,) Ruderman Lab channel standard deviations. Reinhard only.

  • white_point (ndarray | None) – Shape (3,) per-channel white-point estimate. Required for decomposition methods (apply consumes it). Forbidden for Reinhard because Reinhard’s color transfer operates in Ruderman Lab and does not model absorbance. There is no universal default; pass an estimate from your data (see estimate_white_point).

  • max_concentrations (ndarray | None) – Shape (2,) reference per-stain (H, E) 99th-percentile concentrations - a fitted characterization of the reference’s staining strength. Decomposition only, and diagnostic: the colour-basis apply transfers stain colour, not amount, so it does not consume this. Optional; forbidden for Reinhard.

Methods

Attributes

max_concentrations

mu

sigma

stain_matrix

white_point

method