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