topostats.thresholds#

Functions for calculating thresholds.

Attributes#

Functions#

threshold(→ float)

Thresholding for producing masks.

_get_threshold(→ collections.abc.Callable)

Creator component which determines which threshold method to use.

_threshold_otsu(→ float)

_threshold_mean(→ float)

_threshold_minimum(→ float)

_threshold_yen(→ float)

_threshold_triangle(→ float)

Module Contents#

topostats.thresholds.LOGGER#
topostats.thresholds.threshold(image: numpy.ndarray, method: str = None, otsu_threshold_multiplier: float = None, **kwargs: dict) float[source]#

Thresholding for producing masks.

Parameters:
  • method (str) – Method to use for thresholding, currently supported methods are otsu (default), mean and minimum.

  • **kwargs (dict) – Additional keyword arguments to pass to skimage methods.

Returns:

Threshold of image using specified method.

Return type:

float

topostats.thresholds._get_threshold(method: str = 'otsu') collections.abc.Callable[source]#

Creator component which determines which threshold method to use.

Parameters:

method (str) – Threshold method to use, currently supports otsu (default), mean, minimum, mean yen, and triangle.

Returns:

Returns function appropriate for the required threshold method.

Return type:

function

Raises:

ValueError – Unsupported methods result in ValueError.

topostats.thresholds._threshold_otsu(image: numpy.ndarray, otsu_threshold_multiplier: float = None, **kwargs) float[source]#
topostats.thresholds._threshold_mean(image: numpy.ndarray, otsu_threshold_multiplier: float = None, **kwargs) float[source]#
topostats.thresholds._threshold_minimum(image: numpy.ndarray, otsu_threshold_multiplier: float = None, **kwargs) float[source]#
topostats.thresholds._threshold_yen(image: numpy.ndarray, otsu_threshold_multiplier: float = None, **kwargs) float[source]#
topostats.thresholds._threshold_triangle(image: numpy.ndarray, otsu_threshold_multiplier: float = None, **kwargs) float[source]#