StainNormalizer

class StainNormalizer[source]

Stain normalization base class.

This class contains code inspired by StainTools [https://github.com/Peter554/StainTools] written by Peter Byfield.

extractor

Method specific stain extractor.

Type

CustomExtractor, RuifrokExtractor

stain_matrix_target

Stain matrix of target.

Type

numpy.ndarray

target_concentrations

Stain concentration matrix of target.

Type

numpy.ndarray

maxC_target

99th percentile of each stain.

Type

numpy.ndarray

stain_matrix_target_RGB

Target stain matrix in RGB.

Type

numpy.ndarray

Methods

fit

Fit to a target image.

get_concentrations

Estimate concentration matrix given an image and stain matrix.

transform

Transform an image.

fit(target)[source]

Fit to a target image.

Parameters

target (numpy.ndarray of type numpy.uint8) – Target/reference image.

static get_concentrations(img, stain_matrix)[source]

Estimate concentration matrix given an image and stain matrix.

Parameters
Returns

Stain concentrations of input image.

Return type

numpy.ndarray

transform(img)[source]

Transform an image.

Parameters

img (numpy.ndarray of type numpy.uint8) – RGB input source image.

Returns

RGB stain normalized image.

Return type

numpy.ndarray