topostats.thresholds ==================== .. py:module:: topostats.thresholds .. autoapi-nested-parse:: Functions for calculating thresholds. .. !! processed by numpydoc !! Attributes ---------- .. autoapisummary:: topostats.thresholds.LOGGER Functions --------- .. autoapisummary:: topostats.thresholds.threshold topostats.thresholds._get_threshold topostats.thresholds._threshold_otsu topostats.thresholds._threshold_mean topostats.thresholds._threshold_minimum topostats.thresholds._threshold_yen topostats.thresholds._threshold_triangle Module Contents --------------- .. py:data:: LOGGER .. py:function:: threshold(image: numpy.typing.NDArray, method: str = None, otsu_threshold_multiplier: float = None, **kwargs: dict) -> float Thresholding for producing masks. :param image: 2-D Numpy array of image for thresholding. :type image: npt.NDArray :param method: Method to use for thresholding, currently supported methods are otsu (default), mean and minimum. :type method: str :param otsu_threshold_multiplier: Factor for scaling the Otsu threshold. :type otsu_threshold_multiplier: float :param \*\*kwargs: Additional keyword arguments to pass to skimage methods. :type \*\*kwargs: dict :returns: Threshold of image using specified method. :rtype: float .. !! processed by numpydoc !! .. py:function:: _get_threshold(method: str = 'otsu') -> collections.abc.Callable Creator component which determines which threshold method to use. :param method: Threshold method to use, currently supports otsu (default), mean, minimum, mean yen, and triangle. :type method: str :returns: Returns function appropriate for the required threshold method. :rtype: function :raises ValueError: Unsupported methods result in ValueError. .. !! processed by numpydoc !! .. py:function:: _threshold_otsu(image: numpy.typing.NDArray, otsu_threshold_multiplier: float = None, **kwargs) -> float Calculate the Otsu threshold. For more information see `skimage.filters.threshold_otsu() `_. :param image: 2-D Numpy array of image for thresholding. :type image: npt.NDArray :param otsu_threshold_multiplier: Factor for scaling Otsu threshold. :type otsu_threshold_multiplier: float :param \*\*kwargs: Dictionary of keyword arguments to pass to 'skimage.filters.threshold_otsu(**kwargs)'. :type \*\*kwargs: dict :returns: Threshold to be used in masking heights. :rtype: float .. !! processed by numpydoc !! .. py:function:: _threshold_mean(image: numpy.typing.NDArray, otsu_threshold_multiplier: float = None, **kwargs) -> float Calculate the Mean threshold. For more information see `skimage.filters.threshold_mean() `_. :param image: 2-D Numpy array of image for thresholding. :type image: npt.NDArray :param otsu_threshold_multiplier: Factor for scaling (not used). :type otsu_threshold_multiplier: float :param \*\*kwargs: Dictionary of keyword arguments to pass to 'skimage.filters.threshold_mean(**kwargs)'. :type \*\*kwargs: dict :returns: Threshold to be used in masking heights. :rtype: float .. !! processed by numpydoc !! .. py:function:: _threshold_minimum(image: numpy.typing.NDArray, otsu_threshold_multiplier: float = None, **kwargs) -> float Calculate the Minimum threshold. For more information see `skimage.filters.threshold_minimum() `_. :param image: 2-D Numpy array of image for thresholding. :type image: npt.NDArray :param otsu_threshold_multiplier: Factor for scaling (not used). :type otsu_threshold_multiplier: float :param \*\*kwargs: Dictionary of keyword arguments to pass to 'skimage.filters.threshold_minimum(**kwargs)'. :type \*\*kwargs: dict :returns: Threshold to be used in masking heights. :rtype: float .. !! processed by numpydoc !! .. py:function:: _threshold_yen(image: numpy.typing.NDArray, otsu_threshold_multiplier: float = None, **kwargs) -> float Calculate the Yen threshold. For more information see `skimage.filters.threshold_yen() `_. :param image: 2-D Numpy array of image for thresholding. :type image: npt.NDArray :param otsu_threshold_multiplier: Factor for scaling (not used). :type otsu_threshold_multiplier: float :param \*\*kwargs: Dictionary of keyword arguments to pass to 'skimage.filters.threshold_yen(**kwargs)'. :type \*\*kwargs: dict :returns: Threshold to be used in masking heights. :rtype: float .. !! processed by numpydoc !! .. py:function:: _threshold_triangle(image: numpy.typing.NDArray, otsu_threshold_multiplier: float = None, **kwargs) -> float Calculate the triangle threshold. For more information see `skimage.filters.threshold_triangle() `_. :param image: 2-D Numpy array of image for thresholding. :type image: npt.NDArray :param otsu_threshold_multiplier: Factor for scaling (not used). :type otsu_threshold_multiplier: float :param \*\*kwargs: Dictionary of keyword arguments to pass to 'skimage.filters.threshold_triangle(**kwargs)'. :type \*\*kwargs: dict :returns: Threshold to be used in masking heights. :rtype: float .. !! processed by numpydoc !!