squidpy.experimental.im.estimate_white_point

squidpy.experimental.im.estimate_white_point(sdata, image_key, *, tissue_mask_key=None, scale='auto')[source]

Estimate the white point I_0 from a slide’s background (non-tissue median).

Opt-in alternative to the fixed dtype-aware default white point, for a slide whose unstained background is genuinely not full white. Samples the per-channel median over non-tissue pixels (background = the complement of the detect_tissue() mask).

Parameters:
  • sdata (SpatialData) – The SpatialData object and the RGB image key.

  • image_key (str) – The SpatialData object and the RGB image key.

  • tissue_mask_key (str | None) – Tissue-label element key (defaults to f"{image_key}_tissue"); a tissue mask is required, as for fit_stain_reference().

  • scale (Union[str, Literal['auto']]) – Scale level to sample on. "auto" (default) uses the coarsest level. The sampled level is materialised to take the median, so keep this coarse - do not pass a fine level on a whole-slide image.

Return type:

ndarray

Returns:

Shape-(3,) white point; pass it as white_point to fit_stain_reference() / decompose_stains().