Skip to main content

frame_count

How many B-scans a scan holds: its declared count and its measured axis.

Module​

Functions​

declared_num_bscans​

def declared_num_bscans(row: pd.Series) ‑> int | None:

The scan's own B-scan count, when the datasource reported one.

Per-B-scan predictions arrive as one cell per column of a DataFrame that was padded to the widest scan in the inference run, so a scan with fewer frames carries trailing nulls for frames it does not have. The real count is what stops those being measured, and what sizes an en-face region's B-scan axis.

NUMBER_OF_FRAMES_COLUMN is not guaranteed present, so a missing or unparseable value is reported as None and the caller falls back to the last B-scan carrying output. Unparseable is not an error worth failing a scan over: the fallback is correct whenever the padding is what made the tail empty.

Arguments

  • row: One row of the merged per-file metadata.

Returns The frame count, or None when the column is absent or unusable.

scan_bscan_count​

def scan_bscan_count(    num_cells: int, na_bscan_indices: Iterable[int], declared: int | None,) ‑> int:

The number of B-scans in the scan, leaving out trailing padding.

Cells after the last one carrying model output are padding from wider scans in the inference run, unless the declared count says they are frames. The declared count is clamped to the cells supplied, and never discards a frame that carries output. A scan with no output at all keeps every cell.

Arguments

  • num_cells: Number of prediction cells supplied, padding included.
  • na_bscan_indices: Indices of the cells carrying no model output.
  • declared: The scan's declared frame count, or None.

Returns The size of the scan's B-scan axis.