Skip to main content

runs

Contiguous-run reduction over a 1-D boolean row.

One home for the run-length primitive, so every metric that asks "how wide is the widest uninterrupted stretch?" answers it the same way. A run is measured in cells; the caller multiplies by its own spacing, because the physical meaning of a cell differs per axis — B-scan columns are roughly 11.5 µm apart on a macular cube, B-scans themselves roughly 244 µm.

Pure and array-only: nothing here reads a config, a cache, or a scale.

Module

Functions

longest_run

def longest_run(row: NDArray[np.bool_])> int:

Length of the longest contiguous run of True in a 1-D array.

Arguments

  • row: A boolean row — one B-scan's slice of a lesion footprint, or one per-column classification along a single B-scan.

Returns The longest run length in cells, or 0 for an all-False row.