Thresholds Modules
Functions for calculating thresholds.
_get_threshold(method='otsu')
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
function Returns function appropriate for the required threshold method.
Raises
ValueError Unsupported methods result in ValueError.
Source code in topostats/thresholds.py
_threshold_mean(image, otsu_threshold_multiplier=None, **kwargs)
Calculate the Mean threshold.
For more information see skimage.filters.threshold_mean()
<https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.threshold_mean>_.
Parameters
image : npt.NDArray 2-D Numpy array of image for thresholding. otsu_threshold_multiplier : float Factor for scaling (not used). kwargs : dict Dictionary of keyword arguments to pass to 'skimage.filters.threshold_mean(kwargs)'.
Returns
float Threshold to be used in masking heights.
Source code in topostats/thresholds.py
_threshold_minimum(image, otsu_threshold_multiplier=None, **kwargs)
Calculate the Minimum threshold.
For more information see skimage.filters.threshold_minimum()
<https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.threshold_minimum>_.
Parameters
image : npt.NDArray 2-D Numpy array of image for thresholding. otsu_threshold_multiplier : float Factor for scaling (not used). kwargs : dict Dictionary of keyword arguments to pass to 'skimage.filters.threshold_minimum(kwargs)'.
Returns
float Threshold to be used in masking heights.
Source code in topostats/thresholds.py
_threshold_otsu(image, otsu_threshold_multiplier=None, **kwargs)
Calculate the Otsu threshold.
For more information see skimage.filters.threshold_otsu()
<https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.threshold_otsu>_.
Parameters
image : npt.NDArray 2-D Numpy array of image for thresholding. otsu_threshold_multiplier : float Factor for scaling Otsu threshold. kwargs : dict Dictionary of keyword arguments to pass to 'skimage.filters.threshold_otsu(kwargs)'.
Returns
float Threshold to be used in masking heights.
Source code in topostats/thresholds.py
_threshold_triangle(image, otsu_threshold_multiplier=None, **kwargs)
Calculate the triangle threshold.
For more information see skimage.filters.threshold_triangle()
<https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.threshold_triangle>_.
Parameters
image : npt.NDArray 2-D Numpy array of image for thresholding. otsu_threshold_multiplier : float Factor for scaling (not used). kwargs : dict Dictionary of keyword arguments to pass to 'skimage.filters.threshold_triangle(kwargs)'.
Returns
float Threshold to be used in masking heights.
Source code in topostats/thresholds.py
_threshold_yen(image, otsu_threshold_multiplier=None, **kwargs)
Calculate the Yen threshold.
For more information see skimage.filters.threshold_yen()
<https://scikit-image.org/docs/stable/api/skimage.filters.html#skimage.filters.threshold_yen>_.
Parameters
image : npt.NDArray 2-D Numpy array of image for thresholding. otsu_threshold_multiplier : float Factor for scaling (not used). kwargs : dict Dictionary of keyword arguments to pass to 'skimage.filters.threshold_yen(kwargs)'.
Returns
float Threshold to be used in masking heights.
Source code in topostats/thresholds.py
threshold(image, method=None, otsu_threshold_multiplier=None, **kwargs)
Thresholding for producing masks.
Parameters
image : npt.NDArray 2-D Numpy array of image for thresholding. method : str Method to use for thresholding, currently supported methods are otsu (default), mean and minimum. otsu_threshold_multiplier : float Factor for scaling the Otsu threshold. **kwargs : dict Additional keyword arguments to pass to skimage methods.
Returns
float Threshold of image using specified method.
Source code in topostats/thresholds.py
handler: python options: docstring_style: numpy rendering: show_signature_annotations: true