IntensityAnalyzer
Intensity Analyzer for adaptive brush threshold estimation.
This module provides automatic intensity threshold estimation using Gaussian Mixture Models (GMM) or simple statistics as a fallback.
Classes
- class IntensityAnalyzer
Analyze image intensities to estimate segmentation thresholds.
This class fits a Gaussian Mixture Model to the intensity distribution within a region of interest and identifies the component containing the seed point to compute optimal thresholds.
Methods:
- __init__()
Initialize the analyzer.
- mode()
Return the current analysis mode.
- is_gmm_available()
Check if GMM (scikit-learn) is available.
- analyze()
Analyze intensity distribution around seed point.
Functions
- mode()
Return the current analysis mode.
- Returns:
‘GMM’ if using Gaussian Mixture Models, ‘Simple’ if using statistics.
- is_gmm_available()
Check if GMM (scikit-learn) is available.
- Returns:
True if scikit-learn is installed and GMM can be used.
- analyze()
Analyze intensity distribution around seed point.
- Args:
image: Image array (z, y, x ordering for 3D). seed_point: Seed point coordinates (x, y, z). radius_voxels: Optional ROI radius in voxels. If None, uses
a default radius of 20 voxels.
- edge_sensitivity: How strictly to follow intensity boundaries.
0.0 = permissive (wide thresholds), 1.0 = strict (narrow thresholds).
- Returns:
- Dictionary with:
‘lower’: Lower intensity threshold
‘upper’: Upper intensity threshold
‘mean’: Estimated mean of seed region
‘std’: Estimated std of seed region
‘n_components’: Number of GMM components (if GMM used)