Skip to main content

enface

An en-face (front-on) map of a volume scan: hypertransmission and EZ loss.

PROTOTYPE. Each class drawn is reduced to a (num_bscans, num_cols) footprint by the SDK's own parse_bscan_masks, placed on a backdrop by the B-scan positions, and traced to outlines. A client draws the outlines and toggles classes; every class is a model class, with the name, label and colour the B-scan overlays use.

Two backdrops:

  • a native Heidelberg .e2e: the scan's own SLO, with the positions the file records. A scan with no recorded positions fails rather than being guessed at.
  • a DICOM volume, which has neither: a projection of the OCT volume itself (a slab just beneath the RPE). The B-scans are parallel and evenly spaced, so the placement is exact, but the backdrop is not a fundus image.

Module​

Functions​

load_cells​

def load_cells(    cache: CacheProtocol, file_id: str, num_bscans: int,) ‑> tuple[typing.Any, ...]:

Return one prediction cell per B-scan from the stored pathology inference.

Mirrors build_segmentations' record handling (stale-bytes skip, shape detection, B-scan index alignment), so the map is drawn from exactly the records the B-scan overlays are.

Arguments

  • cache: The pod background cache.
  • file_id: The scan's raw ingested path.
  • num_bscans: B-scans in the volume.

Returns num_bscans cells, None where the model produced nothing (all of them when no usable pathology inference matches this volume).

read_map​

def read_map(    path: str, modality: str | None, laterality: str | None,) ‑> EnfaceMap:

Read what a volume's footprints are drawn onto.

Arguments

  • path: Absolute path to the scan file.
  • modality: Optional series selector (see /scans/image).
  • laterality: Optional "L"/"R" selector.

Returns The background and where the B-scans sit on it.

Raises

  • EnfaceUnavailableError: A single-frame series, no SLO beside a native volume, or no recorded positions or spacing.
  • images.UnsupportedScanError: The file could not be read.

render_enface​

def render_enface(    enface_map: EnfaceMap, cells: tuple[Any, ...],) ‑> ScanEnfaceMap:

Trace hypertransmission and EZ loss onto the map.

Arguments

  • enface_map: What the outlines are placed on.
  • cells: One prediction cell per B-scan.

Returns The backdrop, where the B-scans sit on it, and each drawn class's outlines.

Classes​

EnfaceMap​

class EnfaceMap(background: Image.Image, metadata: NDArray[Any], num_bscans: int):

What a footprint is drawn onto.

Arguments

  • background: The image drawn on: the scan's SLO, or a projection of the volume.
  • metadata: [x, y] of the first B-scan's left end, its right end, and the last B-scan's left end, in the background's pixels. Three points are enough to place every B-scan, as they are parallel and evenly spaced.
  • num_bscans: B-scans in the volume.

Variables​

  • background : PIL.Image.Image
  • num_bscans : int

EnfaceUnavailableError​

class EnfaceUnavailableError(reason: EnfaceUnavailableReason, message: str):

En-face does not apply to this scan; reason says why, machine-readably.

Record the machine-readable reason alongside the message.