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: ndarrayThe stain separation matrix as described by G. Landini [1].
channel_axis: int, optionalThis 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
: ValueErrorIf
rgbis 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 + DABhdx_from_rgb: Hematoxylin + DABfgx_from_rgb: Feulgen + Light Greenbex_from_rgb: Giemsa stainMethyl 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.
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