Skip to content

User guide

Circles

POST: /get_etdrs

Description

Builds the ETDRS circle (6mm diameter circle with 3 groups of segments: 1 central (1mm zone), 4 segments (1-3mm zone), 4 segments (3-6mm zone)) for the retinal layers thickness map.

Parameters:

Name Type Description Default
layers_thickness_maps list

layers thickness maps. Has shape of [num_slices, slice_width].

required
used_layers list

list of layers which would be encountered in ETDRS circle calculation. Layers available: ["rnfl", "gcl", "ipl", "inl", "opl", "onl", "elm", "mz", "ez", "os", "rpe"]

required
statistics list

Statistics which should be calculated for each segment. Statistics available: ["mean", "std"]

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
statistics dict

statistics per each segment in format:

{0: {0: {'mean': <float>}}, 1: {0: {...}, 1: {...}, 2: {...}, 3: {...}}, ...}

POST: /get_gcc_circle

Description

Builds the GCC circle (6mm diameter circle with 2 groups of segments: 1 central (1mm zone), 6 segments (1-6mm zone)) for the retinal layers thickness map.

Parameters:

Name Type Description Default
layers_thickness_maps list

layers thickness maps. Usually has shape of [num_slices, slice_width].

required
used_layers list

list of layers which would be encountered in ETDRS circle calculation. Layers available: ["rnfl", "gcl", "ipl", "inl", "opl", "onl", "elm", "mz", "ez", "os", "rpe"]

required
statistics list

Statistics which should be calculated for each segment. Statistics available: ["mean", "std"]

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
statistics dict

statistics per each segment in format:

{0: {0: {'mean': <float>}}, 1: {0: {...}, 1: {...}, 2: {...}, 3: {...}}, ...}

Exam info

GET: /get_exam_type

Description

Calculates the type of the exam based on exam dimensions and fovea/nerve detection status.

Parameters

  • exam_height_mm: float, height of the exam in mm
  • exam_width_mm: float, width of the exam in mm
  • fovea_status: str, fovea detection status; one of "found", "not_found"
  • nerve_status: str, nerve detection status; one of "found", "not_found"
  • wide_scan_boundary_mm: float, optional, default=9.0, upper size bound (mm) for macula/pathological-macula classification
  • optic_disk_scan_boundary_mm: float, optional, default=8.0, upper size bound (mm) for optic disk scan classification
  • unusual_scan_boundary_mm: float, optional, default=3.0, lower size bound (mm) for macula/pathological-macula classification

Returns

JSON object with a single field:

  • status: str, exactly one of the following values (first matching category wins):

    • "is_macula_scan" — fovea found (with or without nerve); size in [unusual_scan_boundary_mm, wide_scan_boundary_mm], or fovea-only with no size info
    • "is_optic_disk_scan" — nerve found without fovea; size at most optic_disk_scan_boundary_mm, or nerve-only with no size info
    • "is_wide_scan" — fovea found (alone or with nerve); size above wide_scan_boundary_mm, or both landmarks found with no size info
    • "is_probably_pathological_macula_scan" — neither fovea nor nerve found; size in [unusual_scan_boundary_mm, wide_scan_boundary_mm]
    • "is_probably_pathological_wide_scan" — neither landmark found, or nerve only without fovea; size above wide_scan_boundary_mm
    • "something_unusual" — does not match any of the categories above

Example response:

{"status": "is_macula_scan"}

Fovea center, fovea and nerve zones

POST: /extract_center_n_fovea

Fovea zone and examination center detection.

Optional parameters are made to make fast changes possible, already set by ML team by default.

Args:

center_probabilities (list)   -- "is_center" model output, probabilities that given slices contain center
fovea_probabilities (list)    -- "is_fovea" model_output, probabilities that the given slices contain fovea pit
indices (list)                -- list of slice indices for which the coordinate belongs (to preserve the order of slices in the examination)
coordinates (list)            -- landmark_coordinates
landmark_probabilities (list) -- landmark_existence_prob

fovea_existence_threshold (float, Optional)           -- threshold for fovea zone existence, default 0.5
fovea_landmark_existence_threshold (float, Optional)  -- threshold for landmark existence, default 0.35
fovea_min_number_of_sequential_slices (int, Optional) -- minimum number of sequential slices to consider the fovea zone, default 2
fovea_connectivity_level (int, Optional)              -- connectivity level for the fovea zone, default 3

JSON (dict): the most probable point to be a center of the examination in the following format: { "status": "found" / "not_found" (no info returned in this case) "fovea_zone_slice_indices": list of slice indices for which the fovea zone was detected "central_slice_index": index of the central slice "fovea_zone_landmarks": list of fovea zone landmarks (len(fovea_zone_slice_indices) x 3 x 2) "exam_center_coordinate": center of the examination in the enface view, [w, n] }

POST: /extract_nerve_zone_landmarks

Nerve zone detection.

Optional parameters are made to make fast changes possible, already set by ML team by default.

Args:

nerve_probabilities (list)    -- "has_nerve" model output, probabilities that given slices contain nerve zone
indices (list)                -- list of slice indices for which the coordinate belongs (to preserve the order of slices in the examination)
coordinates (list)            -- landmark_coordinates
landmark_probabilities (list) -- landmark_existence_prob

nerve_existence_threshold (float, Optional)           -- threshold for nerve zone existence, default 0.3
nerve_confidence_threshold (float, Optional)          -- threshold for nerve zone confidence, default 0.65
nerve_landmark_existence_threshold (float, Optional)  -- threshold for landmark existence, default 0.3
nerve_min_number_of_sequential_slices (int, Optional) -- minimum number of sequential slices to consider the nerve zone, default 2
nerve_connectivity_level (int, Optional)              -- connectivity level for the nerve zone, default 3

Returns:

Name Type Description
JSON dict

the most probable point to be a center of the examination in the following format:

{
    "status":                   "found" / "not_found" (no info returned in this case)
    "nerve_slice_indices":      list of slice indices for which the nerve zone was detected
    "nerve_zone_landmarks":     list of nerve zone landmarks (len(nerve_slice_indices) x 3 x 2)
}

Glaucoma

POST: /get_two_segment_circle

Description

Calculates superior and inferior thicknesses of the retina by its layers. Returns Superior and Inferior parts thicknesses in µm.

Parameters:

Name Type Description Default
layers_thickness_maps dict

layers thickness maps (returned from /get_thickness_map)

required
used_layers list

layers to examine (optional, [“rnfl”, “gcl”, “ipl”] by default)

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Type Description

JSON dict: superior and inferior thicknesses of the retina in µm

{
    "superior_thickness": float,
    "inferior_thickness": float
}

POST: /get_four_segment_circle

Description

Calculates thickness statistics for each element of four segment glaucoma circle.

Parameters:

Name Type Description Default
layers_thickness_maps dict

layers thickness maps (returned from /get_thickness_map)

required
used_layers list

layers to examine (optional, [“rnfl”, “gcl”, “ipl”] by default)

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
statistics_to_get list

Statistics which should be calculated for each segment. Statistics available: ["mean", "std"]. Default: ["mean"]

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
statistics dict

statistics per each segment in µm

POST: /get_full_exam_glaucoma_ppaa_matrix

Description

Calculates PPAA matrix for superior and inferior retina parts for full zone of retina.

Parameters:

Name Type Description Default
layers_thickness_maps dict

layers thickness maps (returned from /get_thickness_map)

required
used_layers list, optional, default=[“rnfl”, “gcl”, “ipl”]

layers to examine

required
use_real_units bool

whether to use real units in PPAA matrix calculation. if False -- pixel units are used.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata. Should be specified if use_real_units==True.

required

Returns:

Type Description

JSON dict in the following format:

{
    "ppaa_matrix": [list, 8x8 PPAA matrix],
    "status": OK | PPAA_NOT_CALCULATED_NEGATIVE_STRIDE (code 415)
}

POST: /get_mmzone_glaucoma_ppaa_matrix

Description

Calculates PPAA matrix for superior and inferior retina parts for defined zone of retina.

More detailed description here: https://media.heidelbergengineering.com/uploads/Products-Downloads/99172-001_SPECTRALIS_Brochure_Posterior-Pole-Insert_EN.pdf

Parameters:

Name Type Description Default
layers_thickness_maps dict

layers thickness maps (returned from /get_thickness_map)

required
used_layers list, optional, default=[“rnfl”, “gcl”, “ipl”]

layers to examine

required
zone_of_interest float, optional, default=6.0

retina zone region in mm which will be used to build the PPAA

required
use_real_units bool

whether to use real units in PPAA matrix calculation. if False -- pixel units are used.

required
- pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
- pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
- slice_thickness float

Slice thickness from DICOM metadata.

required
- scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
- slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
- pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Type Description

JSON dict in the following format:

{
    "ppaa_matrix": [list, 8x8 PPAA matrix],
    "status": OK | PPAA_NOT_CALCULATED_NEGATIVE_STRIDE (code 415)
}

POST: /get_glaucoma_stage

Description

Calculates the probable stage of glaucoma.

Parameters:

Name Type Description Default
superior_thickness float

superior part thickness in µm (from /get_two_segment_circle)

required
inferior_thickness float

inferior part thickness in µm (from /get_two_segment_circle)

required

Returns:

Type Description

JSON dict in the following format:

{
    "stage": 'GREEN' | 'YELLOW' | 'ORANGE | 'RED',
    "status": OK | ONE_OF_THICKNESSES_OUT_OF_BOUNDARIES_OF_THICKNESS_MAXIMUM (code 415)
}

POST: /get_glaucoma_distance_to_normal

Description

Calculates the examination “distance” from normal in terms of glaucoma. 0 means healthy retina, 1 -- glaucoma. Needed for green-yellow-red slider on glaucoma page.

Parameters:

Name Type Description Default
superior_thickness float

superior part thickness in µm (from /get_two_segment_circle)

required
inferior_thickness float

inferior part thickness in µm (from /get_two_segment_circle)

required

Returns:

Type Description

JSON dict in the following format:

{
    "distance_to_normal": <float between 0.0 and 1.0>,
    "status": OK | ONE_OF_THICKNESSES_OUT_OF_BOUNDARIES_OF_THICKNESS_MAXIMUM (code 415)
}

Measurements

POST: /get_linear_calculations

Description

Calculates linear measurements for the pathologies in a single slice of examination.

Parameters:

Name Type Description Default
pathology_segm_instances_per_bscan list

List of outputs from pathology segmentation model, containing segmentation instances for every pathology for a single slice in the following format:

[
    {"points": [], "className": "", ...},
    ...,
    {"points": [], "className": "", ...}
]
required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required

Returns:

Name Type Description
linear_measurements list <dict>

[list of dicts for every instance in pathologies list]

POST: /get_distance_between_two_points

Description

Calculates distance between two points on a slice of examination.

Parameters:

Name Type Description Default
point_from list

[x, y] coordinate of point 1

required
point_to list

[x, y] coordinate of point 2

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required

Returns:

Name Type Description
distance float

distance in real units, mm

POST: /get_bscan_area_calculations_by_polygon

Description

Calculates areas of pathologies per slice.

Example

Input: a list of segmentation instances per one slice: [ {'points': [...], 'className': 'pathology_name_1'}, {'points': [...], 'className': 'pathology_name_2'}, {'points': [...], 'className': 'pathology_name_1'} ] Output: a list of areas that correspond to segmentations instances: [ , , ]

Parameters:

Name Type Description Default
pathology_segm_instances_per_bscan list

list of pathology segmentation instances per one bscan. [{'points': [...], 'className': ..., ...}, ...] -- list of segmentations per slice

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float, optional, default=None

Pixel spacing row from DICOM metadata. Necessary for slice view area calculations.

required

Returns:

Name Type Description
areas dict[list]

areas for each pathology segmentation instance in mm^2 in the following format: { "areas": [float, float, ...] }

POST: /get_bscan_area_calculations_by_mask

Description

Calculates areas of pathologies per slice.

Example

Input: a list of segmentation instances per one slice: [ {'points': [...], 'className': 'pathology_name_1'}, {'points': [...], 'className': 'pathology_name_2'}, {'points': [...], 'className': 'pathology_name_1'} ] Output: a list of areas that correspond to segmentations instances: [ , , ]

Parameters:

Name Type Description Default
pathology_segm_instances_per_bscan list

list of pathology segmentation instances per one bscan.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float, optional, default=None

Pixel spacing row from DICOM metadata. Necessary for slice view area calculations.

required
pixel_image_height int

pixel height of a single B-scan.

required
pixel_image_width int

pixel width of a single B-scan.

required

Returns:

Name Type Description
areas dict[list]

areas for each pathology segmentation instance in mm^2 in the following format: { "areas": [float, float, ...] }

POST: /get_en_face_area_calculations

Description

Calculates areas of pathologies in en-face view.

Example

Input: a list of segmentation instances per one slice: [ {'points': [...], 'className': 'pathology_name_1'}, {'points': [...], 'className': 'pathology_name_2'}, {'points': [...], 'className': 'pathology_name_1'} ] Output: a list of areas that correspond to segmentations instances: [ , , ]

Parameters:

Name Type Description Default
pathology_thickness_maps dict

pathology thickness maps from /get_thickness_map endpoint.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata. Necessary for en-face view area calculations.

required

Returns:

Name Type Description
areas dict

areas for each pathology segmentation instance in mm^2 in the following format: { "areas": { "pathology_name_1": float, ... "pathology_name_n": float } }

POST: /get_volume_calculations

Description

Calculates pathology volume by en-face view thickness map.

Parameters:

Name Type Description Default
pathology_thickness_maps dict

dict of pathologies thickness maps.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required

Returns:

Name Type Description
volumes dict

dict of calculated volumes for each pathology in mm3 in the following format:

{ "volumes": { "pathology_name_1": float, ... "pathology_name_n": float } }

Pathology specific

POST: /get_pathology_volume_etdrs_calculations

Description

Calculates the ETDRS circle based on pathology volume, for levels of the ETDRS circle.

Parameters:

Name Type Description Default
pathology_thickness_maps dict

dict of pathologies thickness maps.

required
is_cumulative bool

whether to calculate ETDRS values in cumulative mode (1mm / 1mm + 3mm / 1mm + 3mm + 6mm zones values).

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
volumes dict

volumes per each segment in format in mm^3:

{
    "pathology_name_1": {0: <float>, 1: <float>, 2: <float>},
    ...,
    "pathology_name_n": {0: <float>, 1: <float>, 2: <float>},
}

POST: /get_pathology_area_etdrs_calculations

Description

Calculates the ETDRS circle based on pathology area, for levels of the ETDRS circle.

Parameters:

Name Type Description Default
pathology_thickness_maps dict

dict of pathologies thickness maps.

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
is_cumulative bool

whether to calculate ETDRS values in cumulative mode (1mm / 1mm + 3mm / 1mm + 3mm + 6mm zones values).

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
areas dict

areas per each segment in format in mm^2:

{
    "pathology_name_1": {0: <float>, 1: <float>, 2: <float>},
    ...,
    "pathology_name_n": {0: <float>, 1: <float>, 2: <float>},
}

POST: /get_pathology_volume_etdrs_calculations_zone

Description

Calculates the ETDRS circle based on pathology volume, per ETDRS segment.

Parameters:

Name Type Description Default
pathology_thickness_maps dict

dict of pathologies thickness maps.

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
volumes dict

volumes per each segment in format in mm^3:

{
    "pathology_name_1": statistics per each segment, as in /get_etdrs,
    ...,
    "pathology_name_n": statistics per each segment, as in /get_etdrs,
}

POST: /get_pathology_area_etdrs_calculations_zone

Description

Calculates the ETDRS circle based on pathology area, per ETDRS segment.

Parameters:

Name Type Description Default
pathology_thickness_maps dict

dict of pathologies thickness maps.

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
areas dict

areas per each segment in format in mm^2:

{
    "pathology_name_1": statistics per each segment, as in /get_etdrs,
    ...,
    "pathology_name_n": statistics per each segment, as in /get_etdrs,
}

POST: /get_maximal_pathology_slice_index_from_thm

Description

Calculates the maximal presence on the thickness map for each pathology. Returns the slice index with the maximal presence.

Parameters:

Name Type Description Default
pathology_thickness_maps dict

dict of pathologies thickness maps in pixel units.

required
exam_center_coordinate_xz list

The center coordinates [x, y] for cropping.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required

Returns:

Name Type Description
max_pathologies dict

maximal presence of pathologies in format:

{
    "pathology_name_1": int,
    ...,
    "pathology_name_n": int,

}

POST: /get_pathology_circle_overlap_ratios

Description

Calculates percentage of the circle area covered by a pathology. The ratio is calculated for 1, 3 and 6 mm circles.

Parameters:

Name Type Description Default
pathology_thickness_map list

Pathology thickness map 2D array of shape [num_slices, pixel_image_width].e

required
slice_thickness float

Slice thickness from DICOM metadata.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Type Description
dict

percentage of the area of each circle covered by the pathology:

{
    "1mm": float,
    "3mm": float,
    "6mm": float
}

POST: /get_pathology_distance_to_fovea_center

Description

Finds minimal distance from a pathology to fovea center.

Parameters:

Name Type Description Default
pathology_thickness_map list

Pathology thickness map 2D array of shape [num_slices, pixel_image_width].

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
distance_to_fovea_center float

distance from the pathology to fovea center in mm

nearest_point list

coordinates of the point which is the nearest to the pathology { "distance_to_fovea_center": float, "nearest_point": list }

Analyzers

POST: /get_pathology_amount

Description

Calculates number of drusen/iHRF on examination. Allowed pathology classes:

  • hard_drusen

  • soft_drusen

  • confluent_drusen

  • drusen

  • intraretinal_hyperreflective_foci

Request Body

pathology_thickness_maps (dict): dict of pathologies thickness maps from /get_pathology_thickness_map endpoint

Response

A JSON object with amount of pathologies instances in the following format:

{
    "pathology_name_1": int,
    ...
    "pathology_name_n": int
}

POST: /get_amd_stage

Description

Calculates AREDS AMD stage for an examination based on drusen thickness maps, pixel spacings, and scan-level disease flags. Allowed pathology classes:

  • hard_drusen

  • soft_drusen

  • confluent_drusen

Request Body

pathology_thickness_maps (dict): dict of drusen thickness maps from /get_pathology_thickness_map endpoint

pixel_spacing_column (float): physical pixel size in column direction (µm)

unique_scan_diseases (list[str]): disease flags present on the scan (e.g. ["dry_amd", "geographic_atrophy"])

Response

A JSON object with the AREDS stage in the following format:

{
    "amd_stage": str  # one of: NO_AMD, EARLY_AMD, INTERMEDIATE_AMD, ADVANCED_AMD
}

Thickness map

POST: /get_layer_thickness_map

Description

Builds the thickness map given the retinal layers segmentation model results. Returns thickness_map and one of statuses: "OK": thickness_map is created successfully and fits into the zone of interest "OK_CROPPED": thickness_map is created and cropped successfully to fit into the zone of interest "OK_PADDED": thickness_map is created and padded successfully to fit into the zone of interest "ZONE_OF_INTEREST_NOT_REACHED": thickness_map is created successfully, but zone of interest is bigger than scanning zone

Parameters:

Name Type Description Default
- segmentation_instances list

list of outputs from retinal layers segmentation model, containing segmentation instances for every slice (length of the list is equal to the amount of scans in examination).

[
    [{"points": [], "className": "", ...}, ...],  -- list of segmentations per slice
    ...,
    [{"points": [], "className": "", ...}, ...]
]
required
- distance_method str, default="axial"

"axial" (faster, finds distance between layer borders within a column) or "min_dist" (slower, finds the shortest distance between the layer borders per each column).

required
- zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
- min_exam_width_mm float

Minimum exam width in mm. If the exam width is less than zone_of_interest and more than this value, padding will be applied to reach zone_of_interest. Default is 5.0 mm.

required
- run_resolution int

resolution of the image to which the input image should be resized. Default is 512.

required
- padding_value int

in case if padding: padding_value will fill the empty space. Default is 0.

required
Metadata from DICOM that contains
required
- pixel_image_height int

pixel height of a single B-scan.

required
- pixel_image_width int

pixel width of a single B-scan (also pixel width of the exam in en-face view).

required
- pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
- slice_thickness float

Slice thickness from DICOM metadata.

required
- scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
- slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
- pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required
- exam_center_coordinate_xz list

coordinates of central scan. Should be a list of 2 elements [scan_x_coordinate, central_slice_number].

required

Returns:

Name Type Description
JSON dict

thickness maps for each segmentation class specified in segmentation_instances in pixel/real units in the following format: { "thickness_maps": { "class_1": [num_slices, pixel_image_width], ... "class_n": [num_slices, pixel_image_width], }, "status": "OK" / "OK_CROPPED" / "OK_CROPPED_PADDED" / "OK_PADDED" / "ZONE_OF_INTEREST_NOT_REACHED" }

POST: /get_pathology_thickness_map

Description

Builds the thickness map given the pathology segmentation model results. Returns thickness_map and one of statuses: "OK": thickness_map is created successfully and fits into the zone of interest "OK_CROPPED": thickness_map is created and cropped successfully to fit into the zone of interest "OK_PADDED": thickness_map is created and padded successfully to fit into the zone of interest "ZONE_OF_INTEREST_NOT_REACHED": thickness_map is created successfully, but zone of interest is bigger than scanning zone "NO_ENFACE_MAPS": no thickness maps were created due to lack of input data

Parameters:

Name Type Description Default
- segmentation_instances list

list of outputs from pathology segmentation model, containing segmentation instances for every slice (length of the list is equal to the amount of scans in examination).

[
    [{"points": [], "className": "", ...}, ...],  -- list of segmentations per slice
    ...,
    [{"points": [], "className": "", ...}, ...]
]
required
- used_segmentation_classes list

list of segmentation classes to be used for thickness map calculation. By default, calculates thickness maps for all segmentation classes found in instances.

required
- use_real_units bool

whether to use real units in thickness map calculation. if False -- pixel units are used.

required
- distance_method str, default="axial"

"axial" (faster, finds distance between layer borders within a column) or "min_dist" (slower, finds the shortest distance between the layer borders per each column).

required
- zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
- min_exam_width_mm float

Minimum exam width in mm. If the exam width is less than zone_of_interest and more than this value, padding will be applied to reach zone_of_interest. Default is 5.0 mm.

required
- run_resolution int

resolution of the image to which the input image should be resized. Default is 512.

required
- padding_value int

in case if padding: padding_value will fill the empty space. Default is 0.

required
Metadata from DICOM that contains
required
- pixel_image_height int

pixel height of a single B-scan.

required
- pixel_image_width int

pixel width of a single B-scan (also pixel width of the exam in en-face view).

required
- pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
- pixel_spacing_row float

Pixel spacing row from DICOM metadata. Should be specified if use_real_units==True.

required
- slice_thickness float

Slice thickness from DICOM metadata.

required
- scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
- slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
- pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required
- exam_center_coordinate_xz list

coordinates of central scan. Should be a list of 2 elements [scan_x_coordinate, central_slice_number].

required

Returns:

Name Type Description
JSON dict

thickness maps for each segmentation class specified in segmentation_instances in pixel/real units in the following format: { "thickness_maps": { "class_1": [num_slices, pixel_image_width], ... "class_n": [num_slices, pixel_image_width], }, "status": "OK" / "OK_CROPPED" / "OK_CROPPED_PADDED" / "OK_PADDED" / "ZONE_OF_INTEREST_NOT_REACHED" / "NO_ENFACE_MAPS"

}

POST: /get_thickness_maps_overlap

Description

Finds the overlap between the given thickness maps.

Parameters:

Name Type Description Default
thickness_maps dict

dict of layers/pathologies thickness maps.

required

Returns:

Name Type Description
thickness_map_overlap dict

a thickness map that is the overlap between the given thickness maps:

{
    "thickness_map_overlap": [num_slices, pixel_image_height]
}

ODN analysis

POST: /extract_neuroretinal_rim_circles

Description

Extracts neuroretinal rim (disc and cup) from optic disc nerve in px. Processes geometry for each slice using landmarks of bruch's membrane opening and ILM layer for further circles extraction.

Length of nerve_landmarks_list, nerve_slices and ilm_list should be the same. Results in nerve_landmarks_list and ilm_list should correspond to the order in nerve_slices. If ilm cannot be extracted from the model, empy list should be sent for this idx.

disc and cup contain coordinates of polygon points. Cup polygon may be empty in case of excavation absence, minimal amount of points for further processing is 4.

disc and cup are returned both in mm and in px for visualization. Polygons for visualization are created based on scanning zone size and scaling factor. It is done to reduce artifacts due to small resolutions.

Parameters:

Name Type Description Default
nerve_landmarks_list list

list of nerve landmarks from landmark (fovea) model.

required
nerve_slices list

list of slices where nerve is present from landmark (fovea) model.

required
ilm_list list

list of ILM layers from retinal layer segmentation model.

required
ellipse_preprocessing bool, optional, default=True

If preprocessing via ellipse fitting is on or raw circles should be returned.

required
fill_absent_slices bool, optional, default=True

If preprocessing via absent slices filling is on or raw circles will be returned.

required
smooth_circles bool, optional, default=True

if disc and cup polygons smoothing should be used.

required
d_mm (float, optional, 150 * 0.001)

distance for raising a parallel line in geometry processing. 150µm is used.

required
scaling_factor_visualization (float, optional, 100.0)

what scaling will be used for pixel extraction, scaling is done based on scanning zone size.

required
num_slices int

number of slices in exam

required
pixel_image_width int

pixel width of a single B-scan (also pixel width of the exam in en-face view).

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Type Description

JSON dict: disc and cup that form a neuroretinal rim.

{
    "disk": list[n,2] in mm,
    "cup": list[m,2] in mm,
    "disk_viz": list[n,2] in px,
    "cup_viz": list[m,2] in px,
}

POST: /analyze_odn

Description

Analyzes optic disc based on neuroretinal rim's disc and cup. Linear, area calculations are conducted for disc, cup and rim. DDLS (disc damage likelyhood scale) analysis is performed for glaucoma stage assessment. DDLS analysis can be processed only if excavation is present, otherwise only disc parameters will be returned.

All calculated parameters are returned in mm/mm2. All points/lists of points for visualization are returned in px.

Parameters:

Name Type Description Default
disk list

list of points for disc, extracted from extract_neuroretinal_rim_circles in mm.

required
cup list

list of points for cup, extracted from extract_neuroretinal_rim_circles in mm.

required
scaling_factor_visualization (float, optional, 100.0)

what scaling will be used for pixel extraction, scaling is done based on scanning zone size.

required

Returns:

Type Description

JSON dict:

{
    "disk_area": area of disc, float in mm2
    "cup_area": area of cup, float in mm2
    "rim_area": area of rim, float in mm2
    "cup_disk_area": cup disc areas ratio, float
    "disk_size": size of the disc, str, one of [small, average, large],
    "odn_mass_center": nerve center of mass, list [1,2] in [x, y] format in px,
    "vertical_DD": vertical disc diameter, float in mm,
    "vertical_DD_line": vertical disc diameter line, list [2,2] in [x, y] format in px, for visualization,
    "horizontal_DD": horizontal disc diameter, float in mm,
    "horizontal_DD_line": horizontal disc diameter line, list [2,2] in [x, y] format in px, for visualization,
    "R": smallest rim width, DDLS analysis, float in mm,
    "R_line": line of R, DDLS analysis, list [2,2] in [x, y] format in px, for visualization,
    "D": disc diameter of the same axis as R, float in mm,
    "D_line": line of D, DDLS analysis, list [2,2] in [x, y] format in px, for visualization,
    "rim_disk_ratio": rim disc length ration, DDLS analysis, float,
    "rim_absence_angle": angle of sequential rim absence (R~0), float in angles, DDLS analysis,
    "rim_absence_sector": sector of rim absence, list [n,2] in [x, y] format in px, for visualization,
    "ddls_stage": stage of glaucoma based on DDLS analysis, int
}

POST: /analyze_odn_rnfl

Description

Analyzes RNFL thickness near the optic disc using circle-based statistics. The thickness map is transformed to the default orientation before analysis.

The type of circle analysis is controlled by analysis_type
  • "quadrant": 4-segment circle (quadrants, start angle -45 deg).
  • "single_segment": single 360-degree segment circle.
  • "twelve_segments": 12-segment circle (clock-hour sectors, start angle -15 deg).
  • "graph": 36-segment circle (10 deg each, start angle -180 deg) for thickness graphs.
  • "all": run all four analyzers; results keyed by analysis type name.

Parameters:

Name Type Description Default
analysis_type str

one of "quadrant", "single_segment", "twelve_segments", "graph", "all".

required
nerve_landmarks_list list

nerve landmarks from landmark model.

required
nerve_slice_indices list

slices where nerve is present.

required
nerve_rnfl_layers list

RNFL layers from retinal layer segmentation model. Supports either legacy per-slice {"instances", "metadata"} dicts or flat polygon instances with scan_index.

required
pixel_height int

image height for flat RNFL polygon instances.

required
pixel_width int

image width for flat RNFL polygon instances.

required
pixel_spacing_row float

Pixel spacing row from DICOM metadata.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
laterality str

"L" or "R".

required
slice_thickness float

Slice thickness from DICOM metadata.

required
num_slices int

amount of slices in the examination.

required
scan_protocol str

"HORIZONTAL_3D" or "VERTICAL_3D".

required
slice_direction str

slice direction of the examination.

required
pixel_direction str

pixel direction of the examination.

required
mm_to_analyze float

distance from the optic disc to analyze in mm, default 1mm.

required

Returns:

Type Description

JSON dict: Single analyzer: {"rnfl_thickness_statistics": {"0": float, ...}} "all": {"rnfl_thickness_statistics": {"quadrant": {...}, "single_segment": {...}, ...}}

POST: /compare_odn_rnfl_graphs

Description

Compares two 36-point ODN RNFL thickness graphs in millimetres and returns inter-eye symmetry using circular interpolation and a tolerance deadband.

Parameters:

Name Type Description Default
graph_a dict

first graph in millimetres, keyed by "0".."35".

required
graph_b dict

second graph in millimetres, keyed by "0".."35".

required
equality_tolerance_mm float

thickness difference considered equal.

required
interpolation_points int

circular interpolation resolution.

required

Returns:

Type Description

JSON dict: {"similarity_score": float}

Vessel Map

GET: /get_vessel_map

Description

Creates a vessel map / fundus-like image from examination sequential images.

Parameters:

Name Type Description Default
input_bucket str

Bucket name where examinations are stored.

required
input_location str

Location in the input_bucket of the examination.

required
input_bucket_cloud str, optional, default="gcp"

Cloud provider where the input_bucket is located. Can be either "gcp" or "azure_uae".

required
inpaint_artifacts bool, optional, default=True

If artifacts inpainting should be used.

required
scaling_factor_visualization (float, optional, 100.0)

what scaling will be used for vessel map, scaling is done based on scanning zone size.

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
vessel_map str

base64 image of shape (scanning zone width x scaling_factor_visualization, scanning zone height x scaling_factor_visualization)

GET: /get_vessel_map_img_space

Description

Creates a vessel map / fundus-like image from examination sequential images. Returns vessel map in image space (img width x num_slices) and one of statuses: "OK": vessel_map is created successfully and fits into the zone of interest "OK_CROPPED": vessel_map is created and cropped successfully to fit into the zone of interest "OK_PADDED": vessel_map is created and padded successfully to fit into the zone of interest "ZONE_OF_INTEREST_NOT_REACHED": vessel_map is created successfully, but zone of interest is bigger than scanning zone

Parameters:

Name Type Description Default
input_bucket str

Bucket name where examinations are stored.

required
input_location str

Location in the input_bucket of the examination.

required
input_bucket_cloud str, optional, default="gcp"

Cloud provider where the input_bucket is located. Can be either "gcp" or "azure_uae".

required
inpaint_artifacts bool, optional, default=True

If artifacts inpainting should be used.

required
scaling_factor_visualization (float, optional, 100.0)

what scaling will be used for vessel map, scaling is done based on scanning zone size.

required
zone_of_interest float

Zone that will be cropped from the center of the thickness map. Default is 6.0 mm.

required
min_exam_width_mm float

Minimum exam width in mm. If the exam width is less than zone_of_interest and more than this value, padding will be applied to reach zone_of_interest. Default is 5.0 mm.

required
padding_value int

in case if padding: padding_value will fill the empty space. Default is 0.

required
exam_center_coordinate_xz list

coordinates of central scan. Should be a list of 2 elements [scan_x_coordinate, central_slice_number].

required
pixel_spacing_column float

Pixel spacing column from DICOM metadata.

required
slice_thickness float

Slice thickness from DICOM metadata.

required
scan_protocol str

scanning protocol of the examination. Can be "HORIZONTAL_3D", "VERTICAL_3D".

required
slice_direction str

slice direction of the examination. Can be "TOP_BOTTOM", "BOTTOM_TOP" for HORIZONTAL_3D protocol or "LEFT_RIGHT", "RIGHT_LEFT" for VERTICAL_3D protocol

required
pixel_direction str

pixel direction of the examination. Can be "LEFT_RIGHT", "RIGHT_LEFT" for HORIZONTAL_3D protocol or "TOP_BOTTOM", "BOTTOM_TOP" for VERTICAL_3D protocol

required

Returns:

Name Type Description
vessel_map list

2D list of vessel map in image space (img width x num_slices)

sstatus

"OK" / "OK_CROPPED" / "OK_PADDED" / "ZONE_OF_INTEREST_NOT_REACHED"