pyrot.eye_modelling.datamodels.export#

Attributes#

Functions#

full_export(output_directory, eyemodelnr, ...)

Exports all relevant data for a given eye model to a structured output directory.

slugify(→ str)

set_level_of_detail(patient, structure_set, ...)

export_roi_geometries(structure_set, output_directory, ...)

Exports ROI geometries from a given structure set to STL files.

export_eye_model(structure_set, output_directory, ...)

Export an eye model to a JSON file.

export_pois(structure_set, output_directory, ...)

Exports points of interest (POIs) from a structure set to a JSON file.

Module Contents#

pyrot.eye_modelling.datamodels.export.logger#
pyrot.eye_modelling.datamodels.export.full_export(output_directory: pathlib.Path | str, eyemodelnr: int, export_suffix: str, roi_export_unit: Literal['Millimeters', 'Centimeters'])#

Exports all relevant data for a given eye model to a structured output directory. This function gathers patient, case, and examination information, creates a uniquely named export directory, and exports ROI geometries, eye model data, and points of interest (POIs) for the specified eye model number.

Parameters#

output_directoryPath or str

The base directory where the export folder will be created.

eyemodelnrint

The identifier number of the eye model to export.

export_suffixstr

Suffix to append to exported files for identification.

roi_export_unitLiteral[“Millimeters”, “Centimeters”]

The unit to use when exporting ROI geometries.

Returns#

None

Notes#

  • The export directory is named using the current date and time, patient name, case name, examination name, and eye model number.

  • The function assumes that the current patient, case, and examination are set and accessible.

pyrot.eye_modelling.datamodels.export.slugify(value: str) str#
pyrot.eye_modelling.datamodels.export.set_level_of_detail(patient, structure_set, level_of_detail: int)#
pyrot.eye_modelling.datamodels.export.export_roi_geometries(structure_set, output_directory: pathlib.Path, examination_name: str, export_suffix: str, roi_export_unit: str)#

Exports ROI geometries from a given structure set to STL files. The function iterates over the ROI geometries in the provided structure set, filters them based on the specified export suffix, and exports each selected geometry as an STL file to the specified output directory. Exported files are named according to the ROI name, with spaces replaced by underscores, and include the export unit in the filename.

Parameters#

structure_setobject

The structure set containing ROI geometries. Must have a RoiGeometries attribute that supports key access.

output_directoryPath

The directory where the exported STL files will be saved.

examination_namestr

The name of the examination (not directly used in the function, but may be required for context).

export_suffixstr

If specified, only ROIs with names ending with this suffix will be exported. If empty, ROIs with automatically generated suffixes are excluded.

roi_export_unitstr

The unit to use when exporting the ROI geometry (e.g., “mm”).

Warns#

UserWarning

If no STL files are found for a given ROI, or if multiple STL files are found (only the first is used).

Notes#

  • Exported STL files are named as {ROI_name}_unit_{roi_export_unit}.stl, with spaces in ROI names replaced by underscores.

  • Temporary directories are used during export to avoid filename conflicts.

  • The function assumes that each geometry object has an ExportRoiGeometryAsSTL method.

pyrot.eye_modelling.datamodels.export.export_eye_model(structure_set, output_directory: pathlib.Path, eyemodelnr: int)#

Export an eye model to a JSON file.

Parameters#

structure_setobject

The structure set containing geometry generators for the eye models.

output_directoryPath

The directory where the exported JSON file will be saved.

eyemodelnrint

The index of the eye model to export from the structure set.

Returns#

None

This function does not return anything. It writes the eye model data to a JSON file.

Notes#

The exported file will be named as “eye_model_{eyemodelnr}.json” and will contain the serialized data of the selected eye model.

pyrot.eye_modelling.datamodels.export.export_pois(structure_set, output_directory: pathlib.Path, examination_name: str)#

Exports points of interest (POIs) from a structure set to a JSON file.

Parameters#

structure_setobject

The structure set containing POI geometries. Must have a PoiGeometries attribute.

output_directoryPath

The directory where the output JSON file (“pois.json”) will be saved.

examination_namestr

The name of the examination to associate with each POI.

Returns#

None

This function does not return anything. It writes the POIs to a JSON file.

Notes#

The output JSON file will contain a dictionary where each key is the POI name and the value is a dictionary with the POI’s location, type, and associated examination name.