pyrot.eye_modelling.datamodels.models#

Data structures for interacting with RayOcular eye models.

Classes#

BaseModel

Abstract base class for RayOcular data models.

EyeModelMeasurements

Store measurements for an eye model.

AnteriorChamber

Store anterior chamber parameters for an eye model.

CiliaryBody

Store ciliary body parameters for an eye model.

Cornea

Store cornea parameters for an eye model.

Eye

Store eye positioning and scale parameters.

Iris

Store iris parameters for an eye model.

Lens

Store lens parameters for an eye model.

Macula

Store macula parameters for an eye model.

OpticalDisc

Store optical disc parameters for an eye model.

OpticalNerve

Store optical nerve parameters for an eye model.

Retina

Store retina parameters for an eye model.

Sclera

Store sclera parameters for an eye model.

VitreousBody

Store vitreous body parameters for an eye model.

EyeModelParameters

Store all parameters that define an eye model.

EyeModel

Store a complete eye model with measurements and parameters.

Module Contents#

class pyrot.eye_modelling.datamodels.models.BaseModel#

Abstract base class for RayOcular data models.

For full functionality, all subclasses must be dataclasses and use the RayOcularField descriptor to define fields that correspond to RayOcular properties.

Methods#

from_rayocular(cls, rayocular_object)

Converts a RayOcular object to an instance of the data model.

to_rayocular(self)

Converts the data model instance to a RayOcular object.

to_dict(self)

Converts the data model instance to a dictionary.

from_dict(cls, data)

Creates an instance of the data model from a dictionary.

classmethod from_rayocular(rayocular_object) _Self#

Convert a RayOcular object to an instance of the data model.

Parameters#

rayocular_objectAny

The RayOcular object to convert.

Returns#

BaseModel

An instance of the data model.

Raises#

ValueError

If any field in the data model does not have a corresponding RayOcular name.

to_rayocular() dict[str, Any]#

Convert the data model instance to a RayOcular dictionary.

Returns#

dict[str, Any]

A dictionary that can be used to update the model in RayOcular.

to_dict() dict[str, Any]#

Convert the data model instance to a dictionary.

This method is only implemented for dataclasses.

Returns#

dict[str, Any]

A dictionary representation of the data model instance.

Raises#

NotImplementedError

If the data model instance is not a dataclass.

classmethod from_dict(data: dict[str, Any]) _Self#

Create an instance of the data model from a dictionary.

This method is only implemented for dataclasses.

Parameters#

datadict[str, Any]

A dictionary representation of the data model instance.

Returns#

BaseModel

An instance of the data model.

Raises#

NotImplementedError

If the data model class is not a dataclass.

TypeError

If the type of any field cannot be resolved.

ValueError

If any required field is missing from the data.

class pyrot.eye_modelling.datamodels.models.EyeModelMeasurements#

Bases: BaseModel

Store measurements for an eye model.

Attributes#

cornea_lens_distancefloat

Distance from cornea to lens.

eye_lengthfloat

Total length of the eye.

eye_widthfloat

Width of the eye.

lens_thicknessfloat

Thickness of the lens.

limbus_diameterfloat

Diameter of the limbus.

class pyrot.eye_modelling.datamodels.models.AnteriorChamber#

Bases: BaseModel

Store anterior chamber parameters for an eye model.

Attributes#

local_rotationVector3[float]

Local rotation of the anterior chamber.

local_scaleVector3[float]

Local scale of the anterior chamber.

local_translationVector3[float]

Local translation of the anterior chamber.

class pyrot.eye_modelling.datamodels.models.CiliaryBody#

Bases: BaseModel

Store ciliary body parameters for an eye model.

Attributes#

base_curvaturefloat

Base curvature of the ciliary body.

heightfloat

Height of the ciliary body.

local_rotationVector3[float]

Local rotation of the ciliary body.

local_scaleVector3[float]

Local scale of the ciliary body.

local_translationVector3[float]

Local translation of the ciliary body.

class pyrot.eye_modelling.datamodels.models.Cornea#

Bases: BaseModel

Store cornea parameters for an eye model.

Attributes#

local_rotationVector3[float]

Local rotation of the cornea.

local_scaleVector3[float]

Local scale of the cornea.

local_translationVector3[float]

Local translation of the cornea.

semi_axisVector3[float]

Semi-axes of the cornea.

thicknessfloat

Thickness of the cornea.

class pyrot.eye_modelling.datamodels.models.Eye#

Bases: BaseModel

Store eye positioning and scale parameters.

Attributes#

pivotVector3[float]

Pivot point of the eye.

rotationVector3[float]

Rotation of the eye.

scaleVector3[float]

Scale of the eye.

translationVector3[float]

Translation of the eye.

class pyrot.eye_modelling.datamodels.models.Iris#

Bases: BaseModel

Store iris parameters for an eye model.

Attributes#

inner_semi_axisRayOcularField[Vector3[float]]

Inner semi-axes of the iris.

outer_semi_axisRayOcularField[Vector3[float]]

Outer semi-axes of the iris.

local_rotationRayOcularField[Vector3[float]]

Local rotation of the iris.

local_scaleRayOcularField[Vector3[float]]

Local scale of the iris.

local_translationRayOcularField[Vector3[float]]

Local translation of the iris.

thicknessRayOcularField[float]

Thickness of the iris.

class pyrot.eye_modelling.datamodels.models.Lens#

Bases: BaseModel

Store lens parameters for an eye model.

Attributes#

curvatureRayOcularField[float]

Curvature of the lens.

local_rotationRayOcularField[Vector3[float]]

Local rotation of the lens.

local_scaleRayOcularField[Vector3[float]]

Local scale of the lens.

local_translationRayOcularField[Vector3[float]]

Local translation of the lens.

semi_axisRayOcularField[Vector3[float]]

Semi-axes of the lens.

class pyrot.eye_modelling.datamodels.models.Macula#

Bases: BaseModel

Store macula parameters for an eye model.

Attributes#

heightRayOcularField[float]

Height of the macula.

local_rotationRayOcularField[Vector3[float]]

Local rotation of the macula.

local_scaleRayOcularField[Vector3[float]]

Local scale of the macula.

local_translationRayOcularField[Vector3[float]]

Local translation of the macula.

rotationRayOcularField[Vector3[float]]

Rotation of the macula.

semi_axisRayOcularField[Vector3[float]]

Semi-axes of the macula.

class pyrot.eye_modelling.datamodels.models.OpticalDisc#

Bases: BaseModel

Store optical disc parameters for an eye model.

Attributes#

heightRayOcularField[float]

Height of the optical disc.

local_rotationRayOcularField[Vector3[float]]

Local rotation of the optical disc.

local_scaleRayOcularField[Vector3[float]]

Local scale of the optical disc.

local_translationRayOcularField[Vector3[float]]

Local translation of the optical disc.

semi_axisRayOcularField[Vector3[float]]

Semi-axes of the optical disc.

class pyrot.eye_modelling.datamodels.models.OpticalNerve#

Bases: BaseModel

Store optical nerve parameters for an eye model.

Attributes#

heightRayOcularField[float]

Height of the optical nerve.

local_rotationRayOcularField[Vector3[float]]

Local rotation of the optical nerve.

local_scaleRayOcularField[Vector3[float]]

Local scale of the optical nerve.

local_translationRayOcularField[Vector3[float]]

Local translation of the optical nerve.

rotationRayOcularField[Vector3[float]]

Rotation of the optical nerve.

semi_axisRayOcularField[Vector3[float]]

Semi-axes of the optical nerve.

class pyrot.eye_modelling.datamodels.models.Retina#

Bases: BaseModel

Store retina parameters for an eye model.

Attributes#

thicknessRayOcularField[float]

Thickness of the retina.

local_rotationRayOcularField[Vector3[float]]

Local rotation of the retina.

local_scaleRayOcularField[Vector3[float]]

Local scale of the retina.

local_translationRayOcularField[Vector3[float]]

Local translation of the retina.

class pyrot.eye_modelling.datamodels.models.Sclera#

Bases: BaseModel

Store sclera parameters for an eye model.

Attributes#

thicknessRayOcularField[float]

Thickness of the sclera.

local_rotationRayOcularField[Vector3[float]]

Local rotation of the sclera.

local_scaleRayOcularField[Vector3[float]]

Local scale of the sclera.

local_translationRayOcularField[Vector3[float]]

Local translation of the sclera.

semi_axisRayOcularField[Vector3[float]]

Semi-axes of the sclera.

class pyrot.eye_modelling.datamodels.models.VitreousBody#

Bases: BaseModel

Store vitreous body parameters for an eye model.

Attributes#

local_rotationRayOcularField[Vector3[float]]

Local rotation of the vitreous body.

local_scaleRayOcularField[Vector3[float]]

Local scale of the vitreous body.

local_translationRayOcularField[Vector3[float]]

Local translation of the vitreous body.

class pyrot.eye_modelling.datamodels.models.EyeModelParameters#

Bases: BaseModel

Store all parameters that define an eye model.

Attributes#

eyeValidatedField[Eye]

Eye positioning and scale parameters.

anterior_chamberValidatedField[AnteriorChamber]

Anterior chamber parameters.

ciliary_bodyValidatedField[CiliaryBody]

Ciliary body parameters.

corneaValidatedField[Cornea]

Cornea parameters.

irisValidatedField[Iris]

Iris parameters.

lensValidatedField[Lens]

Lens parameters.

maculaValidatedField[Macula]

Macula parameters.

optical_discValidatedField[OpticalDisc]

Optical disc parameters.

optical_nerveValidatedField[OpticalNerve]

Optical nerve parameters.

retinaValidatedField[Retina]

Retina parameters.

scleraValidatedField[Sclera]

Sclera parameters.

vitreous_bodyValidatedField[VitreousBody]

Vitreous body parameters.

lens_cornea_distanceValidatedField[float]

Distance from lens to cornea.

level_of_detailValidatedField[int]

Level of detail for geometry rendering.

classmethod from_rayocular(parameters) EyeModelParameters#

Create eye model parameters from a RayOcular object.

Parameters#

parametersobject

The RayOcular eye model parameters object.

Returns#

EyeModelParameters

The created eye model parameters.

to_rayocular() dict[str, Any]#

Convert eye model parameters to a RayOcular dictionary.

Returns#

dict[str, Any]

A dictionary that can be used to update the model in RayOcular.

class pyrot.eye_modelling.datamodels.models.EyeModel#

Bases: BaseModel

Store a complete eye model with measurements and parameters.

Attributes#

measurementsValidatedField[EyeModelMeasurements]

Eye model measurements.

parametersValidatedField[EyeModelParameters]

Eye model parameters.

lateralityRayOcularField[EyeLaterality]

Eye laterality (Left or Right).

descriptionRayOcularField[str]

Description of the eye model.

inter_pupillary_distanceRayOcularField[Optional[float]]

Inter-pupillary distance.

nameRayOcularField[str]

Name of the eye model.

classmethod from_rayocular(geometry_generator) EyeModel#

Create an eye model from a RayOcular geometry generator.

Parameters#

geometry_generatorobject

The RayOcular geometry generator object.

Returns#

EyeModel

The created eye model.

abstract to_rayocular() dict[str, Any]#

Convert the eye model to a RayOcular dictionary.

Raises#

NotImplementedError

This method is not implemented for EyeModel.

classmethod load_json(file_path: os.PathLike | str) EyeModel#

Load an eye model from a JSON file.

Parameters#

file_pathPathLike | str

Path to the JSON file.

Returns#

EyeModel

The loaded eye model.

save_json(file_path: os.PathLike | str) None#

Save the eye model to a JSON file.

Parameters#

file_pathPathLike | str

Path where the JSON file will be saved.