TissueMasker¶

class TissueMasker[source]¶

Base class for tissue maskers.

Takes an image as in put and outputs a mask.

Methods

fit

Fit the masker to the images and parameters.

fit_transform

Perform fit() then transform().

transform

Create and return a tissue mask.

abstract fit(images, masks=None)[source]¶

Fit the masker to the images and parameters.

Parameters:
  • images (numpy.ndarray) – List of images, usually WSI thumbnails. Expected shape is NHWC (number images, height, width, channels).

  • masks (numpy.ndarray) – Target/ground-truth masks. Expected shape is NHW (n images, height, width).

  • self (TissueMasker)

Return type:

None

fit_transform(images, **kwargs)[source]¶

Perform fit() then transform().

Sometimes it can be more optimal to perform both at the same time for a single sample. In this case the base implementation of fit() followed by transform() can be overridden.

Parameters:
  • images (numpy.ndarray) – Image to create mask from.

  • **kwargs (dict) – Other key word arguments passed to fit.

  • self (TissueMasker)

Return type:

ndarray

abstract transform(images)[source]¶

Create and return a tissue mask.

Parameters:
Returns:

Map of semantic classes spatially over the WSI e.g. regions of tissue vs background.

Return type:

numpy.ndarray