pyrot.eye_modelling.match_sclera_to_markers#
Fit the sclera ellipsoid to a set of markers.
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. |
|
Calculate the best-fitting sclera ellipse radii given a marker locations and one or more center translations. |
|
|
Calculate limbus half-axes for one or an array of sclera ellipses so they match the vitreous depth. |
|
Rotates the eye model automatically, based on user input. |
|
Projects a point onto the boundary of an ellipse. |
|
Calculate the angle (in degrees) needed to rotate from one point to another, relative to the same center. |
|
Calculate the optimal rotation angle (in degrees) to align an ellipse point with a manual input. |
Module Contents#
- 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 containing 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 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 model’s limbus diameter matches the measured limbus diameter / white-to-white, without compromising the correctness of anterior chamber biometry.
Uses linear interpolation to find this center translation. By default, it calculates one sample per 0.1 mm to account for the nonlinearity of the limbus diameter and center translation relation. Using fewer samples with quadratic interpolation (for example with scipy) would be more efficient and more 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.
- pyrot.eye_modelling.match_sclera_to_markers.calc_sclera_ellipse_for_center(structure_set: object, eye_model_parameters: object, marker_location: str, center_translations: numpy.ndarray) numpy.ndarray#
- 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[numpy.ndarray]) list[numpy.ndarray]
Calculate the best-fitting sclera ellipse radii given a marker locations and one or more center translations.
For each center translation, the sclera ellipse radii are calculated based on fitting an ellipse to the marker locations. If a single center translation is given, a single set of sclera ellipse radii is returned. If multiple center translations are given, a list of the corresponding sclera ellipse radii is returned.
Parameters#
- structure_setobject
The structure set containing the POI geometries.
- eye_model_parametersobject
The eye model object containing only specific eye parameters.
- marker_locationstr
The location of the markers. Options are ‘clips’, ‘choroid’, ‘nocorrection’.
- center_translationsnp.ndarray | list[np.ndarray]
The center translations to evaluate.
Returns#
- np.ndarray | list[np.ndarray]
A single set of sclera ellipse radii if a single center translation is given, or a list of the corresponding sclera ellipse radii for each center translation if multiple center translations are given.
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 | list#
Calculate limbus half-axes for one or an array of sclera ellipses so they match 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 | 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#
- ValueError
If there are multiple POIs with the specified POI type for the optic nerve/disk location.
- 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 equation 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.
Raises#
- ValueError
If the point is at the center of the ellipse, as the projection is undefined in this case.
- pyrot.eye_modelling.match_sclera_to_markers.calc_angle_between_points(center, from_point, to_point)#
Calculate 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#
Calculate the optimal rotation angle (in degrees) to align an ellipse point with a manual input.
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.