OtsuTissueMasker#

class OtsuTissueMasker[source]#

Tissue masker which uses Otsu’s method to determine background.

Otsu’s method.

Examples

>>> from tiatoolbox.tools.tissuemask import OtsuTissueMasker
>>> masker = OtsuTissueMasker()
>>> masker.fit(thumbnail)
>>> masks = masker.transform([thumbnail])
>>> from tiatoolbox.tools.tissuemask import OtsuTissueMasker
>>> masker = OtsuTissueMasker()
>>> masks = masker.fit_transform([thumbnail])

Initialize OtsuTissueMasker.

Methods

fit

Find a binary threshold using Otsu's method.

transform

Create masks using the threshold found during fit().

fit(images, masks=None)[source]#

Find a binary threshold using Otsu’s method.

Parameters:
  • images (numpy.ndarray) – List of images with a length 4 shape (N, height, width, channels).

  • masks (numpy.ndarray) – Unused here, for API consistency.

  • self (TissueMasker) –

Return type:

None

transform(images)[source]#

Create masks using the threshold found during fit().

Parameters:
  • images (numpy.ndarray) – List of images with a length 4 shape (N, height, width, channels).

  • self (TissueMasker) –

Returns:

List of images with a length 4 shape (N, height, width, channels).

Return type:

numpy.ndarray