Skip to main content

ophth_algo_types

This module contains the dataclasses and constants used in the Ophthalmology.

Module

Functions

max_pathology_prob_col_name

def max_pathology_prob_col_name(pathology_name: str)> str:

Generate the max probability column name for a given pathology.

Classes

CSTMetrics

class CSTMetrics(    *,    cst_mean_um: Optional[float] = None,    cst_median_um: Optional[float] = None,    cst_std_um: Optional[float] = None,    cst_n_samples: Optional[int] = None,    cst_diameter_mm: Optional[float] = None,    fovea_coordinates: Optional[tuple[float, float, float]] = None,    ilm_layer_present: bool = False,    rpe_layer_present: bool = False,    inner_layer_used: Optional[str] = None,    outer_layer_used: Optional[str] = None,    measurement_type: Optional[str] = None,):

Output of the CST/CRT calculation algorithm.

Attributes

  • cst_mean_um: Mean Central Subfield Thickness in micrometers (1mm diameter circle).
  • cst_median_um: Median Central Subfield Thickness in micrometers.
  • cst_std_um: Standard deviation of CST measurements in micrometers.
  • cst_n_samples: Number of samples used in CST calculation.
  • cst_diameter_mm: Diameter of the circular region used for CST calculation in millimeters. If 0, represents single center point measurement.
  • fovea_coordinates: The fovea center coordinates (slice, x, y).
  • ilm_layer_present: Whether ILM layer was detected.
  • rpe_layer_present: Whether RPE layer was detected.
  • inner_layer_used: Name of the inner boundary layer actually used for measurement.
  • outer_layer_used: Name of the outer boundary layer actually used for measurement.
  • measurement_type: Description of the measurement (e.g., "ILM to RPE", "RNFL to RPE").

Variables

  • static cst_diameter_mm : Optional[float]
  • static cst_mean_um : Optional[float]
  • static cst_median_um : Optional[float]
  • static cst_n_samples : Optional[int]
  • static cst_std_um : Optional[float]
  • static fovea_coordinates : Optional[tuple[float, float, float]]
  • static ilm_layer_present : bool
  • static inner_layer_used : Optional[str]
  • static measurement_type : Optional[str]
  • static outer_layer_used : Optional[str]
  • static rpe_layer_present : bool

Static methods


expected_cols

def expected_cols()> list[str]:

Returns the expected columns that should be created for a dataframe.

Methods


to_record

def to_record(self)> dict[str, typing.Any]:

Convert to a record format compatible with pd.DataFrame.from_records().

FluidVolumeMetrics

class FluidVolumeMetrics(    *,    total_fluid_volume: float,    smallest_lesion_volume: float,    largest_lesion_volume: float,    num_bscans_with_fluid: int,    num_fluid_lesions: int,    distance_from_image_centre: float,    max_cnv_probability: float,    max_fluid_volume_bscan_index: Optional[int],    segmentation_volumes: dict[str, float],):

Output of the Fluid Volume calculation algorithm.

Attributes

  • total_fluid_volume: Total volume of fluid in the image in mm^3.
  • smallest_lesion_volume: Volume of the smallest fluid lesion in mm^3.
  • largest_lesion_volume: Volume of the largest fluid lesion in mm^3.
  • num_bscans_with_fluid: Number of B-scans with fluid in the image.
  • num_fluid_lesions: Number of fluid lesions in the image.
  • distance_from_image_centre: Distance from the image centre to the nearest fluid lesion in mm.
  • max_fluid_volume_bscan_index: Index of the B-scan with the largest fluid volume if present, otherwise None.
  • segmentation_volumes: A dictionary containing the volume of each fluid segmentation class in mm^3.

Variables

  • static distance_from_image_centre : float
  • static largest_lesion_volume : float
  • static max_cnv_probability : float
  • static max_fluid_volume_bscan_index : Optional[int]
  • static num_bscans_with_fluid : int
  • static num_fluid_lesions : int
  • static segmentation_volumes : dict[str, float]
  • static smallest_lesion_volume : float
  • static total_fluid_volume : float

Static methods


expected_cols

def expected_cols()> list[str]:

Returns the expected columns that should be created for a dataframe.

For dataframes constructed from this class, there should be a set of expected, core columns.

Methods


to_record

def to_record(self)> dict[str, typing.Any]:

Convert to a record format compatible with pd.DataFrame.from_records().

GAMetrics

class GAMetrics(    *,    total_ga_area: float,    smallest_lesion_size: float,    largest_lesion_size: float,    num_bscans_with_ga: int,    num_ga_lesions: int,    distance_from_image_centre: float,    max_cnv_probability: float,    max_ga_bscan_index: Optional[int],    segmentation_areas: dict[str, float],    max_pathology_probabilities: dict[str, float],):

Output of the GA calculation algorithm.

Attributes

  • total_ga_area: Total area of GA in the image in mm^2.
  • smallest_lesion_size: Size of the smallest lesion in the image in mm^2.
  • largest_lesion_size: Size of the largest lesion in the image in mm^2.
  • num_bscans_with_ga: Number of B-scans with GA in the image.
  • num_ga_lesions: Number of GA lesions in the image.
  • distance_from_image_centre: Distance from the image centre to the nearest lesion in mm. Image centre is used as a proxy for the fovea.
  • max_cnv_probability: Maximum probability of CNV across all B-scans in the image. This value will be between 0 and 1.
  • max_ga_bscan_index: Index of the B-scan with the largest GA lesion if there is GA, otherwise None.
  • segmentation_areas: A dictionary containing the area of each segmentation class in the image in mm^2.

Variables

  • static distance_from_image_centre : float
  • static largest_lesion_size : float
  • static max_cnv_probability : float
  • static max_ga_bscan_index : Optional[int]
  • static max_pathology_probabilities : dict[str, float]
  • static num_bscans_with_ga : int
  • static num_ga_lesions : int
  • static segmentation_areas : dict[str, float]
  • static smallest_lesion_size : float
  • static total_ga_area : float

Static methods


expected_cols

def expected_cols()> list[str]:

Returns the expected columns that should be created for a dataframe.

For dataframes constructed from this class, there should be a set of expected, core columns.

Methods


to_record

def to_record(    self, additional_pathology_prob_cols: Optional[Collection[str]] = None,)> dict[str, typing.Any]:

Convert to a record format compatible with pd.DataFrame.from_records().

By default this will be all fields in the dataclass, except for max_pathology_probabilities. If additional record entries containing these pathology probabilities are wanted, supply arguments via additional_pathology_prob_cols which match the pathology name. This will create additional record entries called "max_[pathology_name]_probability" for each one requested.

GAMetricsWithFovea

class GAMetricsWithFovea(    *,    total_ga_area: float,    smallest_lesion_size: float,    largest_lesion_size: float,    num_bscans_with_ga: int,    num_ga_lesions: int,    distance_from_image_centre: float,    max_cnv_probability: float,    max_ga_bscan_index: Optional[int],    segmentation_areas: dict[str, float],    max_pathology_probabilities: dict[str, float],    distance_from_fovea_centre: Optional[float],    fovea_centre: Optional[tuple[int, int, int]],    fovea_landmarks: list[tuple[int, int, int]],    est_fovea_distance: float,    distance_metric_type: str,    subfoveal_indicator: Optional[str],):

Output of the GA calculation algorithm with fovea detection.

Attributes

  • distance_from_fovea_centre: Distance from the fovea to the nearest lesion in mm where applicable and possible to calcualte.
  • fovea_centre: Coordinates of the fovea centre in the image if detected. Coordinates are in the form (slice, x, y).
  • est_fovea_distance: The final distance metric used for trial inclusion. If fovea distance is not available, this will be the distance from the image centre.

Ancestors

Variables

  • static distance_from_fovea_centre : Optional[float]
  • static distance_metric_type : str
  • static est_fovea_distance : float
  • static fovea_centre : Optional[tuple[int, int, int]]
  • static fovea_landmarks : list[tuple[int, int, int]]
  • static subfoveal_indicator : Optional[str]

Static methods


expected_cols

def expected_cols()> list[str]:

Inherited from:

GAMetrics.expected_cols :

Returns the expected columns that should be created for a dataframe.

For dataframes constructed from this class, there should be a set of expected, core columns.

Methods


to_record

def to_record(    self, additional_pathology_prob_cols: Optional[Collection[str]] = None,)> dict[str, typing.Any]:

Inherited from:

GAMetrics.to_record :

Convert to a record format compatible with pd.DataFrame.from_records().

By default this will be all fields in the dataclass, except for max_pathology_probabilities. If additional record entries containing these pathology probabilities are wanted, supply arguments via additional_pathology_prob_cols which match the pathology name. This will create additional record entries called "max_[pathology_name]_probability" for each one requested.

ImageFieldType

class ImageFieldType(column: str):

Stores information for an image field.

Variables

  • static column : str

OCTImageMetadataColumns

class OCTImageMetadataColumns(    height_mm_column: str = 'dimensions_mm_height',    width_mm_column: str = 'dimensions_mm_width',    depth_mm_column: str = 'dimensions_mm_depth',):

Dataclass for storing columns related to the OCT dimensions.

Arguments

  • height_mm_column: The name of the column for where the height in mm of the OCT image. Defaults to dimensions_mm_height.
  • width_mm_column: The name of the column for where the width in mm of the OCT image. Defaults to dimensions_mm_width.
  • depth_mm_column: The name of the column for where the depth in mm of the OCT image. Defaults to dimensions_mm_depth.

Ancestors

  • bitfount.types.UsedForConfigSchemas

Variables

  • static depth_mm_column : str
  • static height_mm_column : str
  • static width_mm_column : str

ParsedBScanPredictions

class ParsedBScanPredictions(    column_masks: NDArray[np.floating],    class_probabilities: dict[str, NDArray[np.floating]],    class_areas: dict[str, list[float]],):

Container for the various outputs of parsing bscan predictions.

Attributes

  • column_masks: Numpy array mask of shape (num_bscans, num_cols) where num_bscans is the number of B-scans in the array and num_cols is the number of columns in each B-scan.

  • class_probabilities: A mapping of class name (e.g. "cnv", "hard_drusen") to a numpy array of probabilities for that pathology for each B-scan.

  • class_areas: A mapping of class name (e.g. "cnv", "hard_drusen") to a list of area (in mm^2) of that pathology on each B-scan. e.g.:

    {
  • segmentation_class_name: [ area_in_mm2_in_bscan_0, area_in_mm2_in_bscan_1, ..., ] }

Variables

  • static class_areas : dict[str, list[float]]

ReportMetadata

class ReportMetadata(    text_fields: list[TextFieldType],    heading: Optional[str] = None,    image_field: Optional[ImageFieldType] = None,):

Dataclass for storing pdf report metadata fields.

Ancestors

  • bitfount.types.UsedForConfigSchemas

Variables

  • static heading : Optional[str]

RetinalLayer

class RetinalLayer(value, names=None, *, module=None, qualname=None, type=None, start=1):

Retinal layers ordered from inner (vitreous side) to outer (choroid side).

Ancestors

Variables

  • static BRUCHS_MEMBRANE
  • static ELM
  • static EZ
  • static GCL
  • static ILM
  • static INL
  • static IPL
  • static MZ
  • static ONL
  • static OPL
  • static OS
  • static RNFL
  • static RPE_LAYER

SLOImageMetadataColumns

class SLOImageMetadataColumns(    height_mm_column: str = 'slo_dimensions_mm_height',    width_mm_column: str = 'slo_dimensions_mm_width',):

Dataclass for storing columns related to the SLO dimensions.

Arguments

  • height_mm_column: The name of the column for where the height in mm of the SLO image. Defaults to slo_dimensions_mm_height.
  • width_mm_column: The name of the column for where the width in mm of the SLO image. Defaults to slo_dimensions_mm_width.

Ancestors

  • bitfount.types.UsedForConfigSchemas

Variables

  • static height_mm_column : str
  • static width_mm_column : str

SLOSegmentationLocationPrefix

class SLOSegmentationLocationPrefix(    start_x_image: str = 'loc_start_x_image_',    start_y_image: str = 'loc_start_y_image_',    end_x_image: str = 'loc_end_x_image_',    end_y_image: str = 'loc_end_y_image_',):

Dataclass for location columns prefixes for the OCT images on the SLO.

Arguments

  • start_x_image: Column name prefix where the start x-axis pixel location of the first OCT image is on SLO. Defaults to loc_start_x_image_.
  • start_y_image: Column name prefix where the start y-axis pixel location of the first OCT image is on SLO. Defaults to loc_start_y_image_.
  • end_x_image: Column name prefix where the end x-axis pixel location of the first OCT image is on SLO. Defaults to loc_end_x_image_.
  • end_y_image: Column name prefix where the end y-axis pixel location of the first OCT image is on SLO. Defaults to loc_end_y_image_.

Ancestors

  • bitfount.types.UsedForConfigSchemas

Variables

  • static end_x_image : str
  • static end_y_image : str
  • static start_x_image : str
  • static start_y_image : str

TextFieldType

class TextFieldType(    heading: str,    column: Optional[str] = None,    value: Optional[str] = None,    datetime_format: Optional[str] = None,):

Stores information for a text field.

Variables

  • static column : Optional[str]
  • static datetime_format : Optional[str]
  • static heading : str
  • static value : Optional[str]

TrialNotesCSVArgs

class TrialNotesCSVArgs(    columns_for_csv: list[str],    columns_from_data: Optional[dict[str, str]] = None,    columns_to_populate_with_static_values: Optional[dict[str, str]] = None,    eligible_only: bool = True,):

Dataclass for storing the arguments for the trial notes CSV.

Arguments

  • columns_for_csv: The columns to include in the trial notes CSV.
  • columns_from_data: The columns to include from the data. Defaults to None.
  • columns_to_populate_with_static_values: The columns to populate with static values. Defaults to None

Variables

  • static columns_for_csv : list[str]
  • static columns_from_data : Optional[dict[str, str]]
  • static columns_to_populate_with_static_values : Optional[dict[str, str]]
  • static eligible_only : bool