vista.algorithms.detectors.threshold.SimpleThreshold

class vista.algorithms.detectors.threshold.SimpleThreshold(threshold, min_area=1, max_area=1000, detection_mode='above')[source]

Detector that uses a fixed threshold to find blobs.

Uses regionprops to identify connected regions above or below threshold, or both, filtered by area, and returns weighted centroids as detections.

__init__(threshold, min_area=1, max_area=1000, detection_mode='above')[source]

Initialize the Simple Threshold detector.

Parameters:
  • threshold (float) – Intensity threshold for detection.

  • min_area (int, optional) – Minimum detection area in pixels. Default is 1.

  • max_area (int, optional) – Maximum detection area in pixels. Default is 1000.

  • detection_mode ({'above', 'below', 'both'}, optional) –

    Detection mode controlling how threshold is applied:

    • ’above’: Detect pixels > threshold (default)

    • ’below’: Detect pixels < -threshold (negative values)

    • ’both’: Detect pixels where |pixel| > threshold (absolute value)

Methods

__init__(threshold[, min_area, max_area, ...])

Initialize the Simple Threshold detector.

Attributes

name = 'Simple Threshold'
__init__(threshold, min_area=1, max_area=1000, detection_mode='above')[source]

Initialize the Simple Threshold detector.

Parameters:
  • threshold (float) – Intensity threshold for detection.

  • min_area (int, optional) – Minimum detection area in pixels. Default is 1.

  • max_area (int, optional) – Maximum detection area in pixels. Default is 1000.

  • detection_mode ({'above', 'below', 'both'}, optional) –

    Detection mode controlling how threshold is applied:

    • ’above’: Detect pixels > threshold (default)

    • ’below’: Detect pixels < -threshold (negative values)

    • ’both’: Detect pixels where |pixel| > threshold (absolute value)

__call__(image)[source]

Process a single image and return detections.

Parameters:

image (ndarray) – 2D numpy array representing a single image frame to process.

Returns:

  • rows (ndarray) – Array of row coordinates (y-positions) for detection centroids.

  • columns (ndarray) – Array of column coordinates (x-positions) for detection centroids.

Raises:

ValueError – If detection_mode is not ‘above’, ‘below’, or ‘both’.

Notes

The detector: 1. Applies threshold based on detection_mode to create a binary mask 2. Labels connected components in the binary mask 3. Filters regions by area (min_area <= area <= max_area) 4. Computes weighted centroids for qualifying regions 5. Returns centroid coordinates as (rows, columns) tuple