pywsi.normalization package

Submodules

pywsi.normalization.macenko module

class pywsi.normalization.macenko.MacenkoNormalization(beta=0.15, alpha=1, lambda1=0.01, lambda2=0.01, gamma1=0.01, maskout_white=True, nonwhite_threshold=0.8)[source]

Bases: object

fit(target_image)[source]

Fit attributes to target image.

Parameters:
target_image:
get_both_stains(vis=True)[source]

Get the 3 channel values belonging to both stainsn

Parameters:
vis: bool

Should visualize?

get_concentrations(image, stain_matrix)[source]

Get concentration matrix.

Parameters:
image: array_like

rgb

Returns:
concentration: array_like

N x 2 matrix for an N x M case.

get_eosin_channel(source_image=None, total=True)[source]

Get eosin channel concentration of source or target image.

If source image is providedd, then the returned value represents the target stain vector remains the same, the source image concentration is then calculated by an inverse calculation C = IS^{-1}

If no source image is provided, it simply returns the concentration channel of the target image, second column in this case.

get_eosin_stain(vis=True)[source]

Get the 3 channel values belonging to the eosin stain

Parameters:
vis: bool

Should visualize?

Returns:
E: array_like

A length 3 vector of RGB values

get_hematoxylin_channel(source_image=None, total=True)[source]

Get hematoxylin channel concentration of source or target image.

If source image is providedd, then the returned value represents the target stain vector remains the same, the source image concentration is then calculated by an inverse calculation C = IS^{-1}

If no source image is provided, it simply returns the concentration channel of the target image, first column in this case.

get_hematoxylin_stain(vis=True)[source]

Get the 3 channel values belonging to the hematoxylin stain

Parameters:
vis: bool

Should visualize?

Returns:
H: array_like

A length 3 vector of RGB values

get_stain_matrix(source_image)[source]

OD = SV. Get V

Parameters:
source_image: array_like

np.unit8 array of rgb values

Returns:
stain_matrix: array_like

2 x M matrix for a N x M matrix

transform(source_images)[source]

Transform source image to target.

Parameters:
source_image: list(array_like)

np.unit8 rgb input

Returns:
reconstructed: array_like

np.uint8 transformed image

pywsi.normalization.reinhard module

class pywsi.normalization.reinhard.ReinhardNormalization[source]

Bases: object

Reinhard Normalization

fit(target_image)[source]

Fit target image by storing its mean/std.

Parameters:
target_image: array_like

np.uint8 of rgb values

static get_mean_and_std(image)[source]

Get image mean and std for all channels

transform(source_image)[source]

Perform normalization on source image.

Parameters:
source_image: array_like

np.uint8 of rgb values

Module contents