models
What the scans served.
One scan's own verdict and evidence, the frames of a scan image with the manifest describing them, and the segmentation index beside it.
Classes
ScanEnfaceBscanAxis
class ScanEnfaceBscanAxis(**data: Any):Where the volume's B-scans sit on the en-face map, in its pixels.
Three points place every B-scan, because they are parallel and evenly spaced:
B-scan i of n runs from first_start + t * (last_start - first_start) to
first_end + t * (last_start - first_start), with t = i / (n - 1). A client
uses it to mark the B-scan it is showing.
Arguments
first_start:[x, y]of the first B-scan's left end.first_end:[x, y]of the first B-scan's right end.last_start:[x, y]of the last B-scan's left end.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
first_end : list[float]
- static
first_start : list[float]
- static
last_start : list[float]
- static
model_config
ScanEnfaceClass
class ScanEnfaceClass(**data: Any):One segmentation class on the en-face map.
The name, label and colour are the ones segmentations.json serves for the same
class on a B-scan, so a client can keep one legend and one on/off state for both.
Arguments
name: The normalised class name; the stable key to match state on.label: The human-readable name to render.colour: Advisory display RGB, as[r, g, b].polygons: The class's footprint on the map, as outlines in the map's pixels, each a flat[x0, y0, x1, y1, …]. Fill them with the even-odd rule: a hole in the footprint (foveal sparing, say) is an outline inside one.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
colour : list[int]
- static
label : str
- static
model_config
- static
name : str
- static
polygons : list[list[int]]
ScanEnfaceMap
class ScanEnfaceMap(**data: Any):An en-face (front-on) map of a volume scan, with every segmentation class.
The footprints are served as outlines, not pictures, so a client draws them over the backdrop and switches classes on and off without another request.
Arguments
backdrop_png_base64: The image the outlines sit on, as a base64 grayscale
Variables
- static
backdrop_png_base64 : str
- static
bscan_axis : ScanEnfaceBscanAxis
- static
classes : list[ScanEnfaceClass]
- static
height : int
- static
model_config
- static
num_bscans : int
- static
width : int
ScanEvidence
class ScanEvidence(**data: Any):One scan's own eligibility verdict and evidence.
Mirrors a scan_eligibility row. Where EligibilityEvidence serves the
patient rollup — which carries the criteria of a single determined_by_scan
and nothing from the others — this is each scan as it was actually
evaluated, so a caller can see a measured eye alongside an unmeasurable one
rather than only whichever scan the rollup selected.
A scan whose criteria could not be computed still appears, with status
unknown and entries whose value is None; that is a result, not an
omission. Only scans that reached scan_eligibility are here — a file
dropped earlier by the task's own filters has no row and no representation.
Arguments
scan_id: The scan identifier, asEligibilityEvidence.determined_by_scanreports it, so a caller can mark which scan decided the verdict. It is what identifies the scan: match scans by it, never byfile_path.file_path: The scan file this verdict came from, spelled as it is on the pod's disk: the path to show, and oneGET /scans/imageaccepts aspath. On a Windows pod it can differ fromscan_idin letter case, where the files are on a case-sensitive share.laterality: The scanned eye as recorded (L/R, or a vendor value), orNonewhen the source did not state one.study_date: The scan's study date, orNonewhen not recorded.status: This scan's own verdict, before any patient-level rollup.evidence: Per-criterion evidence for this scan, in the same shape asEligibilityEvidence.evidence— entries are identical in structure, so one client type serves both. Stored unwrapped inscan_eligibility; thecriteriawrapper is applied here so the two endpoints agree.processed_at: When this scan's row was written.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
evidence : EligibilityEvidenceBody
- static
file_path : str
- static
laterality : str | None
- static
model_config
- static
processed_at : datetime.datetime | None
- static
scan_id : str
- static
status : bitfount.cache.types._eligibility_shared.EligibilityStatus
- static
study_date : str | None
ScanEvidenceList
class ScanEvidenceList(**data: Any):Envelope for a patient's per-scan evidence on one trial.
Paginated on the same envelope as PatientList: a patient can accumulate
scans across visits without bound, so this is not assumed to be a short list.
Arguments
items: The scans on the requested page, most recentstudy_datefirst andscan_idbreaking ties, so ordering is stable across calls.total: The number of scans for the (patient, trial) before pagination.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
ScanImageFrame
class ScanImageFrame(**data: Any):One frame's entry in a scan-image archive's manifest.json.
Arguments
index: The frame's position in the archive, from 0.filename: The frame's archive member name (frame_NNN.webp).modality: The frame's modality in the SDK's vocabulary — the same two values a task filter or a datasource takes.nullwhen the source states none (a DICOM carrying no acquisition-device-type tag) or states something that is neither an OCT nor an SLO: a colour photo, an angiography series, an encapsulated PDF. Readseries_modalityto tell those apart, and switch on this field rather than that one.series_modality: The source's own, finer modality label — the lower-casedprivate_eyedescription, sooctbut alsoslo - red,colour photo,red-free (cross-polarized). Carries whatmodality's normalisation drops: which SLO channel a frame came from, and what anull-modality series actually is.nullon the DICOM path, whose tag is already in the SDK vocabulary and has no finer label behind it. Open-ended, and a vendored parser's spelling rather than this API's — do not switch on it.laterality: The series' detected laterality, ornullwhen unknown — which is every DICOM-path frame, since the requestedlateralityfilter is never echoed back as detected metadata.B(both eyes) andU(explicitly unknown) are possible alongsideL/R.source_width: The frame's width before scaling, in px.source_height: The frame's height before scaling, in px.width: The encoded width, in px — the requested width clamped tosource_width.height: The encoded height, in px.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
filename : str
- static
height : int
- static
index : int
- static
laterality : Literal['L', 'R', 'B', 'U'] | None
- static
modality : Literal['OCT', 'SLO', None]
- static
model_config
- static
series_modality : str | None
- static
source_height : int
- static
source_width : int
- static
width : int
ScanImageManifest
class ScanImageManifest(**data: Any):The manifest.json inside a GET /scans/image archive.
Documented for consumers of the archive; never served as a response body.
Arguments
format: The frame encoding — alwayswebp.quality: The WebP quality the frames were encoded at (0-100).acquisition_datetime: When the series was acquired, ornullwhen the file states nothing — a normal outcome, not an error, so a consumer must render the absence rather than assume a date. Read from the source's own metadata: on the DICOM path the first ofAcquisitionDateTime,AcquisitionDate(+AcquisitionTime),ContentDate(+ContentTime) orStudyDate(+StudyTime) that states a value; on the native-vendor path the exam'sscan_datetime, falling back to the earliest B-scan capture time. A date whose paired time is absent reads as midnight. Carries a UTC offset only where the source stated one — a DICOM date/time pair states no zone, and one is not invented.frames: One entry perframe_NNN.webpmember, in archive order.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
acquisition_datetime : datetime.datetime | None
- static
format : Literal['webp']
- static
frames : list[ScanImageFrame]
- static
model_config
- static
quality : int
ScanSegmentationIndex
class ScanSegmentationIndex(**data: Any):The segmentations.json inside a GET /scans/image archive.
Present when either include_segmentation_masks or
include_segmentation_vectors is set; absent from the archive entirely when
neither is. Documented for consumers of the archive; never served as a
response body, and — like the frames and the manifest beside it — served
compactly, since it carries one entry per class per frame.
Arguments
frames: One entry per served frame, in frame order.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
SegmentationClass
class SegmentationClass(**data: Any):One segmentation class on one frame, from one model.
Carries mask, instances, or both — never neither, since a class present in
neither requested output is omitted from classes entirely. Each key is
absent, not null, when its layer was not requested.
Arguments
name: The normalised class name (every non-word character replaced with an underscore, then lower-cased), and the stable key to match state and filters on. It is also whatsegmentation_classesfilters against.label: The human-readable name to render, falling back tonamefor a class with no registered label.colour: Advisory display RGB, as[r, g, b], falling back to[200, 200, 200]. It matches the PDF report's legend; a UI may override it.probability: The highest instance probability for this class on this frame, ornullwhen the model reported none.mask: Archive-relative path of this class's mask PNG. Absent when masks were not requested, and also when downscaling to the served width erased every pixel of the raster — which is what can leave a thinpolylineclass with vectors and no mask.instances: The class's raw drawable instances, un-collapsed, so per-instance identity and probability survive (a mask unions them into one plane). Absent when vectors were not requested.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
colour : tuple[int, int, int]
- static
instances : list[SegmentationInstance] | None
- static
label : str
- static
mask : str | None
- static
model_config
- static
name : str
- static
probability : float | None
SegmentationFrame
class SegmentationFrame(**data: Any):All segmentation output for one served frame.
Arguments
index: The frame's index, matching itsframe_NNN.webpmember.filename: That member's name, so a consumer need not rebuild it fromindex.width: The served frame's width in px. A mask PNG is this wide, so it composites onto the frame with no client-side scaling.height: The served frame's height in px.source_width: The frame's native width in px, before scaling.source_height: The frame's native height in px.sources: One entry per model that produced output for this frame. Empty (not absent) for a frame nothing produced output for.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
filename : str
- static
height : int
- static
index : int
- static
model_config
- static
source_height : int
- static
source_width : int
- static
sources : list[SegmentationSource]
- static
width : int
SegmentationInstance
class SegmentationInstance(**data: Any):One drawable instance inside a segmentations.json class entry.
Coordinates are in the model's own pixel space (mask_width/mask_height on
the parent source), not the served frame's — see scale_x/scale_y.
Only the geometry belonging to type is present: a key that does not apply
is omitted rather than served as null. probability is the exception —
it is always present, and is null when the model reported none.
Arguments
type: The instance's geometry. Apolygonand anellipsebound a region whose interior carries the class; apolylineis an open curve with no interior, used for retinal-layer boundaries, and a rasterised one is given a 3px stroke in model space and nothing wider. Instance types carrying no area (point, and anything unrecognised) are dropped before the index is built, so none reaches a consumer.probability: The model's confidence for this instance, ornullwhen it reported none. Per instance, not per class: the parent class entry carries its own.points: Flat[x0, y0, x1, y1, …], onpolygonandpolylineonly.cx: Ellipse centre x. Present onellipseonly, as are the four below.cy: Ellipse centre y.rx: Ellipse semi-axis x.ry: Ellipse semi-axis y.angle: Ellipse rotation, in degrees.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
angle : int | None
- static
cx : int | None
- static
cy : int | None
- static
model_config
- static
points : list[int] | None
- static
probability : float | None
- static
rx : int | None
- static
ry : int | None
- static
type : Literal['polygon', 'polyline', 'ellipse']
SegmentationSource
class SegmentationSource(**data: Any):Every class one model produced for one frame.
Two models can produce output for the same frame, and both can carry the same
class name, so a legend is grouped by source rather than by class name alone.
Arguments
model_ref: The model that produced this output.model_version: That model's version.kind: Which pipeline recognised the output's shape.mask_width: Width of the model's own coordinate space, which everyinstancescoordinate is in.mask_height: Height of that space.dims_match_source: Whether that space matches the frame's native dims.falsemeans the model inferred at some other size, which a client may want to treat with suspicion.scale_x:width / mask_width, full precision — the factor mapping a vector's x onto the served frame. An SVG overlay needs no arithmetic at all:viewBox="0 0 {mask_width} {mask_height}"absorbs it, which is why the server never pre-scales a vector (scalingrx/ryindependently would deform a rotated ellipse).scale_y:height / mask_height, the same for y.classes: One entry per class this model produced on this frame.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
classes : list[SegmentationClass]
- static
dims_match_source : bool
- static
kind : Literal['pathology', 'retinal_layers']
- static
mask_height : int
- static
mask_width : int
- static
model_config
- static
model_ref : str
- static
model_version : int
- static
scale_x : float
- static
scale_y : float