topostats.thresholds#

Functions for calculating thresholds.

Attributes#

Functions#

threshold(→ float)

Factory method for thresholding.

_get_threshold(→ 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]#

Factory method for thresholding.

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') Callable[source]#

Creator component which determines which threshold method to use.

Parameters:

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

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]#