skimage2.color.combine_stains#

skimage2.color.combine_stains(stains, conv_matrix, *, channel_axis=-1)[source]#

Stain to RGB color space conversion.

Parameters:
stainsarray_like of shape (…, C=3, …)

The image in stain color space. By default, the final dimension denotes channels.

conv_matrixndarray

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

channel_axisint, optional

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

Added in version 0.19: channel_axis was added in 0.19.

Returns:
outndarray of shape (…, C=3, …)

The image in RGB format. Same dimensions as input.

Raises:
ValueError

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

Notes

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

  • rgb_from_hed: Hematoxylin + Eosin + DAB

  • rgb_from_hdx: Hematoxylin + DAB

  • rgb_from_fgx: Feulgen + Light Green

  • rgb_from_bex: Giemsa stain : Methyl Blue + Eosin

  • rgb_from_rbd: FastRed + FastBlue + DAB

  • rgb_from_gdx: Methyl Green + DAB

  • rgb_from_hax: Hematoxylin + AEC

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

  • rgb_from_bpx: Methyl Blue + Ponceau Fuchsin

  • rgb_from_ahx: Alcian Blue + Hematoxylin

  • rgb_from_hpx: Hematoxylin + PAS

References

[2]

A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution,” Anal. Quant. Cytol. Histol., vol. 23, no. 4, pp. 291–299, Aug. 2001.

Examples

>>> from _skimage2 import data
>>> from _skimage2.color import (separate_stains, combine_stains,
...                            hdx_from_rgb, rgb_from_hdx)
>>> ihc = data.immunohistochemistry()
>>> ihc_hdx = separate_stains(ihc, hdx_from_rgb)
>>> ihc_rgb = combine_stains(ihc_hdx, rgb_from_hdx)