phenotypic.enhance.FrangiVesselness#
- class phenotypic.enhance.FrangiVesselness(sigmas: Iterable[float] = (0.5, 1, 1.5), alpha: float = 0.5, beta: float = 0.5, gamma: float | None = None, black_ridges: bool = False)[source]
Bases:
ImageEnhancerEnhance tubular structures in detect_mat using Hessian-based vesselness filtering.
Computes the Frangi vesselness measure from Hessian matrix eigenvalues at multiple scales, producing a response map that highlights elongated features (hyphae, branches, mycelial networks). The output is a probability-like map (0–1) that typically requires thresholding before detection.
For algorithm details, see The Filamentous Fungi Detection Algorithm.
- Parameters:
sigmas (Iterable[float]) – Scales (standard deviations) for Hessian computation. Smaller values detect finer structures; larger values detect thicker ones. Span the expected range of hyphal widths in pixels. Default:
(0.5, 1, 1.5).alpha (float) – Blobness sensitivity (0–1). Lower is more permissive. Default: 0.5.
beta (float) – Structuredness sensitivity (0–1). Lower is more permissive. Default: 0.5.
gamma (float) – Background suppression threshold. Larger values suppress low-curvature (flat) regions more aggressively.
Noneuses half of the max Hessian norm. Default:None.black_ridges (bool) – If
True, detect dark ridges on bright background. IfFalse, detect bright ridges on dark background. Default:False.
- Returns:
Input image with
detect_matset to the vesselness response map.rgbandgrayare unchanged.- Return type:
Image
- Best For:
Filamentous fungi (Neurospora, Aspergillus) with branching hyphae.
Thin, elongated structures that global thresholding misses.
Interconnected mycelial networks or biofilm structures.
Pre-filtering before
FilamentousFungiDetector.
- Consider Also:
MeijeringRidgeFilterfor neurite-like structures with fewer parameters to tune.SatoRidgeFilterfor ridge detection with different sensitivity characteristics.PhaseCongruencyEnhancerfor illumination-invariant edge enhancement of filaments.
References
[1] A. F. Frangi, W. J. Niessen, K. L. Vincken, and M. A. Viergever, “Multiscale vessel enhancement filtering,” in MICCAI, 1998, pp. 130–137.
See also
Tutorial 10: Detecting Filamentous Fungi for a visual walkthrough of filamentous fungi detection. The Filamentous Fungi Detection Algorithm for the theory behind Hessian-based vesselness filtering.
Methods
Applies the operation to an image, either in-place or on a copy.
Return (and optionally display) the root widget.
- __init__(sigmas: Iterable[float] = (0.5, 1, 1.5), alpha: float = 0.5, beta: float = 0.5, gamma: float | None = None, black_ridges: bool = False)[source]
- Parameters:
sigmas (tuple | list) – Sequence of standard deviations for Gaussian derivatives. Smaller values detect finer features, larger values detect thicker structures. Default (0.5, 1, 1.5).
alpha (float) – Vesselness sensitivity to blobness. Lower values are more permissive. Range: 0 to 1. Default 0.5.
beta (float) – Vesselness sensitivity to structuredness. Lower values are more permissive. Range: 0 to 1. Default is None which uses half of the max Hessian norm.
gamma (float) – Threshold for background suppression. Larger values suppress low-curvature regions more aggressively. Default 15.
black_ridges (bool) – If True, detect dark ridges (colonies) on bright background. If False, detect bright ridges on dark background. For agar plates with dark colonies on light background, use True. Default False.
- __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)
Applies the operation to an image, either in-place or on a copy.
- Parameters:
image (Image) – The arr image to apply the operation on.
inplace (bool) – If True, modifies the image in place; otherwise, operates on a copy of the image.
- Returns:
The modified image after applying the operation.
- Return type:
Image
- widget(image: Image | None = None, show: bool = False) Widget
Return (and optionally display) the root widget.
- Parameters:
image (Image | None) – Optional image to visualize. If provided, visualization controls will be added to the widget.
show (bool) – Whether to display the widget immediately. Defaults to False.
- Returns:
The root widget.
- Return type:
ipywidgets.Widget
- Raises:
ImportError – If ipywidgets or IPython are not installed.