Skip to main content

etdrs

Metrics regarding OCTs.

Module

Functions

compute_subfields

def compute_subfields(    img_array: np.ndarray,    laterality: Laterality,    slo_num_pixels_width: int,    slo_num_pixels_height: int,    slo_dimension_mm_width: float,    slo_dimension_mm_height: float,    fovea_coordinates: Optional[Coordinates] = None,)> MaculaSubFields:

Compute GA affected area of macula ETDRS subfields.

Arguments

  • img_array: Image as a square 2D numpy array.
  • laterality: The laterality of the image (left or right).
  • slo_num_pixels_width: Number of pixels in the width of the image array.
  • slo_num_pixels_height: Number of pixels in the height of the image array.
  • slo_dimension_mm_width: Width in mm of the image array.
  • slo_dimension_mm_height: Height in mm of the image array.
  • fovea_coordinates: The coordinates corresponding to the fovea. If not provided, the fovea will be assumed to be in the centre of the image.

Returns A nested dictionary of ETDRS subfields contained affected areas in mm^2.

compute_subfields_oct

def compute_subfields_oct(    img_array: np.ndarray,    laterality: Laterality,    oct_width_mm: float,    oct_depth_mm: float,    oct_num_pixels_width: int,    oct_num_pixels_height: int,    fovea_coordinates: Optional[Coordinates] = None,)> MaculaSubFields:

Compute GA affected area of macula ETDRS subfields.

Arguments

  • img_array: Image as a square 2D numpy array.
  • laterality: The laterality of the image (left or right).
  • oct_width_mm: Width in mm of the image array.
  • oct_depth_mm: Height in mm of the image array.
  • oct_num_pixels_width: Number of pixels in the width of the image array.
  • oct_num_pixels_height: Number of pixels in the height of the image array.
  • fovea_coordinates: The coordinates corresponding to the fovea. If not provided, the fovea will be assumed to be in the centre of the image.

Returns A nested dictionary of ETDRS subfields contained affected areas in mm^2.

get_num_pixels_ga

def get_num_pixels_ga(img_array: np.ndarray)> int:

Returns the number of pixels in the image which demonstrate GA.

get_point_distance_from_fovea

def get_point_distance_from_fovea(    point_coordinates: Coordinates,    fovea_coordinates: Coordinates,    mm_per_pixel_x: float,    mm_per_pixel_y: float,)> float:

Calculates and returns a point's distance from the fovea in mm.

get_quadrant

def get_quadrant(    point_coordinates: Coordinates,    fovea_coordinates: Coordinates,    laterality: Laterality,)> Quadrant:

Gets the quadrant that a point is in, in relation to the fovea.

Arguments

  • point_coordinates: The coordinates of the point in question.
  • fovea_coordinates: The coordinates of the fovea.
  • laterality: Whether the image is of the left eye or the right eye. This has no impact on superior or inferior quadrants but determines whether a coordinate is in the nasal quadrant or the temporal quadrant.

Returns The quadrant the point would be in. This does not take into account the distance from the fovea and therefore the point may fall inside the fovea (which has no quadrants) or it may so far from the fovea that it does not fall into any of the macula subfields.

Raises

  • ValueError: If the quadrant cannot be calculated due to an unexpected value in the inputs to the function.

get_zone

def get_zone(distance_from_fovea: float)> Optional[Zone]:

Returns the zone corresponding to how far a point is from the fovea.

Returns None if the point is further than the outer diameter.

is_pixel_ga

def is_pixel_ga(pixel: np.ndarray)> bool:

Returns whether a given pixel from an en-face image is GA based on the colour.

is_point_above_line

def is_point_above_line(a: Coordinates, b: Coordinates, c: Coordinates)> bool:

Returns True if point c is above line formed from points a and b.

Arguments

  • a: A point on a line.
  • b: Another point on the same line as point a.
  • c: A set of coordinates whcih can be anywhere in relation to the line formed by points a and b.

Returns True if point c would lie above the line formed by a and b, otherwise False. The line can be thought to be extrapolated if point c falls outside the length of the line.