skimage2.color.separate_stains#
- skimage2.color.separate_stains(rgb, conv_matrix, *, channel_axis=-1)[source]#
RGB to stain color space conversion.
- Parameters:
- rgbarray_like of shape (…, C=3, …)
The image in RGB format. 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_axiswas added in 0.19.
- Returns:
- outndarray of shape (…, C=3, …)
The image in stain color space. Same dimensions as input.
- Raises:
- ValueError
If
rgbis not at least 2-D with shape (…, C=3, …).
Notes
Stain separation matrices available in the
colormodule and their respective colorspace:hed_from_rgb: Hematoxylin + Eosin + DABhdx_from_rgb: Hematoxylin + DABfgx_from_rgb: Feulgen + Light Greenbex_from_rgb: Giemsa stain : Methyl Blue + Eosinrbd_from_rgb: FastRed + FastBlue + DABgdx_from_rgb: Methyl Green + DABhax_from_rgb: Hematoxylin + AECbro_from_rgb: Blue matrix Anilline Blue + Red matrix Azocarmine + Orange matrix Orange-Gbpx_from_rgb: Methyl Blue + Ponceau Fuchsinahx_from_rgb: Alcian Blue + Hematoxylinhpx_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.
References
[1][3]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, hdx_from_rgb >>> ihc = data.immunohistochemistry() >>> ihc_hdx = separate_stains(ihc, hdx_from_rgb)