TissueMasker¶
- class TissueMasker[source]¶
Base class for tissue maskers.
Takes an image as in put and outputs a mask.
Methods
Fit the masker to the images and parameters.
Perform
fit()
thentransform()
.Create and return a tissue mask.
- abstractmethod 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()
thentransform()
.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 bytransform()
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:
- abstractmethod transform(images)[source]¶
Create and return a tissue mask.
- Parameters:
images (
numpy.ndarray
) – RGB image, usually a WSI thumbnail.self (TissueMasker)
- Returns:
Map of semantic classes spatially over the WSI e.g. regions of tissue vs background.
- Return type: