phenotypic.detect.YenDetector#
- class phenotypic.detect.YenDetector(ignore_zeros: bool = True, ignore_borders: bool = True)[source]#
Bases:
ThresholdDetectorClass for applying Yen’s thresholding to an image.
This class inherits from the ThresholdDetector and provides the functionality to apply Yen’s thresholding method on the enhance gray (enh_gray) of an arr image. The operation generates a binary mask (objmask) depending on the computed threshold other_image.
- apply()#
Applies Yen’s thresholding on the arr image object and modifies its omask attribute accordingly.
Methods
__init__Binarizes the given image gray using the Yen threshold method.
Drop references to the UI widgets.
Push internal state into widgets.
Return (and optionally display) the root widget.
- __del__()#
Automatically stop tracemalloc when the object is deleted.
- __getstate__()#
Prepare the object for pickling by disposing of any widgets.
This ensures that UI components (which may contain unpickleable objects like input functions or thread locks) are cleaned up before serialization.
Note
This method modifies the object state by calling dispose_widgets(). Any active widgets will be detached from the object.
- apply(image, inplace=False)#
Binarizes the given image gray using the Yen threshold method.
This function modifies the arr image by applying a binary mask to its enhanced gray (enh_gray). The binarization threshold is automatically determined using Yen’s method. The resulting binary mask is stored in the image’s objmask attribute.
- widget(image: Image | None = None, show: bool = False) Widget#
Return (and optionally display) the root widget.
- Parameters:
- Returns:
The root widget.
- Return type:
ipywidgets.Widget
- Raises:
ImportError – If ipywidgets or IPython are not installed.