{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / color / colorconv / separate_stains

function

skimage.color.colorconv:separate_stains

source: /dev/scikit-image/src/skimage/color/colorconv.py:1667

Signature

def separate_stains(rgb, conv_matrix, *, channel_axis = -1)

Summary

RGB to stain color space conversion.

Parameters

rgb : array_like of shape (..., C=3, ...)

The image in RGB format. By default, the final dimension denotes channels.

conv_matrix : ndarray

The stain separation matrix as described by G. Landini [1].

channel_axis : int, optional

This parameter indicates which axis of the array corresponds to channels.

Returns

out : ndarray of shape (..., C=3, ...)

The image in stain color space. Same dimensions as input.

Raises

: ValueError

If rgb is not at least 2-D with shape (..., C=3, ...).

Notes

Stain separation matrices available in the color module and their respective colorspace:

  • hed_from_rgb: Hematoxylin + Eosin + DAB

  • hdx_from_rgb: Hematoxylin + DAB

  • fgx_from_rgb: Feulgen + Light Green

  • bex_from_rgb: Giemsa stainMethyl Blue + Eosin

  • rbd_from_rgb: FastRed + FastBlue + DAB

  • gdx_from_rgb: Methyl Green + DAB

  • hax_from_rgb: Hematoxylin + AEC

  • bro_from_rgb: Blue matrix Anilline Blue + Red matrix Azocarmine + Orange matrix Orange-G

  • bpx_from_rgb: Methyl Blue + Ponceau Fuchsin

  • ahx_from_rgb: Alcian Blue + Hematoxylin

  • hpx_from_rgb: Hematoxylin + PAS

This implementation borrows some ideas from DIPlib [2], e.g. the compensation using a small value to avoid log artifacts when calculating the Beer-Lambert law.

Examples

from skimage import data
from skimage.color import separate_stains, hdx_from_rgb
ihc = data.immunohistochemistry()
ihc_hdx = separate_stains(ihc, hdx_from_rgb)
✓

Aliases

  • skimage.color.separate_stains