Skip to main content

functions

Functions for the GA calculation without fovea step.

The shared low-level primitives live in bitfount.steps.data_utils.ga_metrics. This module re-exports compute_ga_metrics_for_scan for convenience and to keep the step package self-contained.

Module

Functions

compute_ga_metrics_for_scan

def compute_ga_metrics_for_scan(    bscan_predictions: tuple[str, ...],    slice_thickness: float,    pixel_spacing_column: float,    all_segmentation_labels: dict[str, int],    ga_area_include_segmentations: list[str],    ga_area_exclude_segmentations: list[str],    n_scan_biomarker_thresholds: Mapping[str, float] | None = None,    include_raw_pathology_probabilities: bool = False,)> GAMetrics:

Compute GA metrics for a single scan (without fovea).

This encapsulates the per-file computation loop body from _WorkerSide.run() (lines 268-343 in the original).

Arguments

  • bscan_predictions: The raw per-B-scan prediction JSON strings.
  • slice_thickness: The distance between B-scans in mm.
  • pixel_spacing_column: The pixel spacing along the B-scan column axis.
  • all_segmentation_labels: All segmentation label names to class index.
  • ga_area_include_segmentations: Segmentation labels to include when computing the GA area column mask.
  • ga_area_exclude_segmentations: Segmentation labels to exclude when computing the GA area column mask.
  • n_scan_biomarker_thresholds: Per-biomarker >= probability threshold used to compute n_scan_run_lengths. Keys define which N-scan biomarkers are evaluated; when None, every label in N_SCAN_BIOMARKER_LABELS defaults to 0.5.
  • include_raw_pathology_probabilities: Whether to include the raw per-B-scan pathology probability arrays on the returned metrics.

Raises

  • Exception: Propagates any exception from prediction parsing or metric computation so that the caller can handle/skip.