pyrot.eye_modelling.match_sclera_to_markers#
Attributes#
Functions#
|
Fit an ellipsoid to the markers, without using biometry data. |
Calculate the ellipsoid center location so it matches the WTW-width at vitreous depth. |
|
|
Returns best fitting sclera ellipse radii to marker locations for one or an array of ellipse center locations. |
|
Determines limbus half-axes of one or an array of sclera ellipses so it matches the vitreous depth. |
|
Rotates the eye model automatically, based on user input. |
|
Projects a point onto the boundary of an ellipse. |
|
Computes the angle (in degrees) needed to rotate from one point to another, |
|
Main wrapper function to compute the optimal rotation angle (in degrees) |
Module Contents#
- pyrot.eye_modelling.match_sclera_to_markers.logger#
- pyrot.eye_modelling.match_sclera_to_markers.match_sclera_to_markers(structure_set: object, eye_model_generators: object, eye_model_parameters: object, eye_shape: str, marker_location: str, center_translation: list | None = None) None#
Fit an ellipsoid to the markers, without using biometry data.
Parameters#
- structure_setobject
The structure set containing the POI geometries.
- eye_model_generatorsobject
The eye model containing eye parameters.
- eye_model_parametersobject
An object with only specific eye model parameters
- eye_shapestr
The shape of the eye model. Options are “sphere”, “EYEPLAN”, “ellipsoid”, “ellipsoid_fixedCenter”. “sphere” returns a sphere “EYEPLAN” returns an ellipsoid with the same radii in IS and LR directions “ellipsoid” returns an ellipsoid “ellipsoid_fixedCenter” returns an ellipsoid but uses use a predefined shift in ellipsoid center location
- marker_locationstr
The location of the markers. Options are ‘clips’, ‘choroid’, ‘nocorrection’. “clips” means the location of the clips, which are sutured on the sclera “choroid” means the markers are localized on the choroid For both “clips” and “choroid”, the relevant correction is performed to obtain the sclera radii
- center_translationlist, optional
The translation of the center, by default [0, 0, 0] (but this is defined in the function as to not use mutable data structures for argument defaults).
Raises#
- NotImplementedError
If an unsupported eye shape or marker location is provided.
- pyrot.eye_modelling.match_sclera_to_markers.calc_sclera_center_to_match_white_to_white(structure_set: object, eye_model_parameters: object, marker_location: str, biometry_data: dict, evaluations_start: float = -0.1, evaluations_stop: float = 0.2, n_evaluations: int = 31) float#
Calculate the ellipsoid center location so it matches the WTW-width at vitreous depth. This is to ensure the models limbus diameter matches the measured limbus diameter/ White To White, without compromising on correctness of anterior chamber biometry.
Uses linear interpolation to find this center translation. By default calculates one sample per .1 mm to account for the nonlinearity of the limbus diameter and center translation relation. Using less samples with a quadratic interpolation using e.g. scipy would be more efficient/ elegant, but this is not possible in some (clinical) RayOcular scripting environments.
Parameters#
- structure_setobject
The structure set containing the POI geometries.
- eye_model_parametersobject
An object containing only specific eye model parameters
- marker_locationstr
The location of the markers. Options are ‘clips’, ‘choroid’, ‘nocorrection’.
- biometry_datadict
The biometry data containing measurements like ‘AL’, ‘AD’, ‘AD_offset’, and ‘WTW’.
- evaluations_startfloat
The minimal center translation to be evaluated in cm, by default -.1
- evaluations_stopfloat
The maximal center translation to be evaluated in cm, by default .2
- n_evaluationsint, optional
The number of evaluations for center translations, by default 31.
Returns#
- float
The center translation based on the WTW radius.
Raises#
- LookupError
If the WTW radius is outside the range of evaluated limbus half-axes. This would mean the limbus diameter of the model would differ from the measured limbus diameter
- pyrot.eye_modelling.match_sclera_to_markers.calc_sclera_ellipse_for_center(structure_set: object, eye_model_parameters: object, marker_location: str, center_translations: list) list#
Returns best fitting sclera ellipse radii to marker locations for one or an array of ellipse center locations.
Parameters#
- structure_setobject
The structure set containing the POI geometries.
- eye_model_parametersobject
The eye model object containing only eye parameters
- marker_locationstr
The location of the markers. Options are ‘clips’, ‘choroid’, ‘nocorrection’.
- center_translationslist
The center translations to evaluate.
Returns#
- list
List of radii for each center translation.
Raises#
- NotImplementedError
If an unsupported marker location is provided.
- pyrot.eye_modelling.match_sclera_to_markers.calc_limbusrad(eye_model_parameters: object, biometry_data: dict, radii_list: list) float or list#
Determines limbus half-axes of one or an array of sclera ellipses so it matches the vitreous depth.
Parameters#
- eye_model_parametersobject
An object containing only specific eye parameters
- biometry_datadict
The biometry data containing measurements like ‘AL’, ‘AD’, and ‘AD_offset’.
- radii_listlist
List of radii for each center translation.
Returns#
- float or list
The limbus half-axes for the given sclera ellipses.
- pyrot.eye_modelling.match_sclera_to_markers.rotate_eye_model(structure_set: object, eye_model_generators: object, eye_model_parameters: object, poi_type_on: str, roi_name_od: str, roi_name_vitreous: str, based_on: str = 'optic_disk')#
Rotates the eye model automatically, based on user input.
Parameters#
- structure_setobject
The structure set containing the POI geometries.
- eye_model_generatorsobject
The eye model containing eye parameters.
- eye_model_parametersobject
An object containing specific eye parameters
- poi_type_onstr
The poi type the poi that defines the optic nerve/disk location is designated by It is necessary that there is only one poi of this type
- based_onstr
What the rotation will be based on. Currently, only ‘optic_disk’ is supported
- roi_name_odstr
The name of the ROI of the optic disk in the eye model
Raises#
- NotImplementedError
If the method designated in the ‘based_on’ variable is not supported
- pyrot.eye_modelling.match_sclera_to_markers.project_point_to_ellipse(center, axes, point)#
Projects a point onto the boundary of an ellipse. Does this by first calculating the function of the line between the point and the center of the sclera. Subsequently, the intersection between this line and the sclera ellipse is calculated.
Parameters#
- center (tuple)
(x_c, y_c) center of the ellipse.
- axes (tuple)
(a, b) ellipse semi-axes.
- point (tuple)
(x, y) coordinates of the point to project.
Returns#
tuple: (x_proj, y_proj) coordinates of the projected point on the ellipse.
- pyrot.eye_modelling.match_sclera_to_markers.calc_angle_between_points(center, from_point, to_point)#
Computes the angle (in degrees) needed to rotate from one point to another, relative to the same center.
Parameters#
- center (tuple)
(x_c, y_c) center of rotation.
- from_point (tuple)
(x1, y1) starting point.
- to_point (tuple)
(x2, y2) target point.
Returns#
float : Rotation angle in degrees (positive = counter-clockwise).
- pyrot.eye_modelling.match_sclera_to_markers.calc_rotation_to_align_points(retina_center: tuple, retina_axes: tuple, optic_disc_eyemodel: tuple, optic_disc_poi: tuple) float#
Main wrapper function to compute the optimal rotation angle (in degrees) to align an ellipse_point with the projection of a manual_input.
Parameters#
- retina_center (tuple)
(x_c, y_c) center of the ellipse.
- retina_axes (tuple)
(a, b) retina ellipse axes.
- optic_disc_eyemodel (tuple)
the location of the optic disk of the current eye model
- optic_disc_poi (tuple)
the clicked poi of the actual location of the optic disk
Returns#
float : Rotation angle in degrees.