Skip to content

eyepy.core.eyemeta

EyeBscanMeta(start_pos, end_pos, pos_unit, **kwargs)

Bases: EyeMeta

A dict with required keys to hold meta data for OCT B-scans.

Parameters:

Name Type Description Default
start_pos tuple[float, float]

B-scan start on the enface (in enface space)

required
end_pos tuple[float, float]

B-scan end on the enface (in enface space)

required
pos_unit str

Unit of the positions

required
**kwargs
{}
Source code in src/eyepy/core/eyemeta.py
def __init__(
    self,
    start_pos: tuple[float, float],
    end_pos: tuple[float, float],
    pos_unit: str,
    **kwargs,
) -> None:
    """A dict with required keys to hold meta data for OCT B-scans.

    Args:
        start_pos: B-scan start on the enface (in enface space)
        end_pos: B-scan end on the enface (in enface space)
        pos_unit: Unit of the positions
        **kwargs:
    """
    start_pos = tuple(start_pos)
    end_pos = tuple(end_pos)
    super().__init__(start_pos=start_pos,
                     end_pos=end_pos,
                     pos_unit=pos_unit,
                     **kwargs)

EyeEnfaceMeta(scale_x, scale_y, scale_unit, **kwargs)

Bases: EyeMeta

A dict with required keys to hold meta data for enface images of the eye.

Parameters:

Name Type Description Default
scale_x float

Horizontal scale of the enface pixels

required
scale_y float

Vertical scale of the enface pixels

required
scale_unit str

Unit of the scale. e.g. µm if scale is given in µm/pixel

required
**kwargs
{}
Source code in src/eyepy/core/eyemeta.py
def __init__(self, scale_x: float, scale_y: float, scale_unit: str,
             **kwargs) -> None:
    """A dict with required keys to hold meta data for enface images of the
    eye.

    Args:
        scale_x: Horizontal scale of the enface pixels
        scale_y: Vertical scale of the enface pixels
        scale_unit: Unit of the scale. e.g. µm if scale is given in µm/pixel
        **kwargs:
    """
    super().__init__(scale_x=scale_x,
                     scale_y=scale_y,
                     scale_unit=scale_unit,
                     **kwargs)

from_dict(data) classmethod

Parameters:

Name Type Description Default
data dict
required

Returns:

Source code in src/eyepy/core/eyemeta.py
@classmethod
def from_dict(cls, data: dict) -> 'EyeEnfaceMeta':
    """

    Args:
        data:

    Returns:

    """
    for key in ['visit_date', 'exam_time']:
        if key in data.keys() and data[key] is not None:
            data[key] = datetime.datetime.fromisoformat(data[key])
    return cls(**data)

EyeMeta(*args, **kwargs)

Bases: MutableMapping

Parameters:

Name Type Description Default
*args
()
**kwargs
{}
Source code in src/eyepy/core/eyemeta.py
def __init__(self, *args, **kwargs) -> None:
    """

    Args:
        *args:
        **kwargs:
    """
    self._store = dict()
    self.update(dict(*args, **kwargs))  # use the free update to set keys

as_dict()

Returns:

Source code in src/eyepy/core/eyemeta.py
def as_dict(self) -> dict:
    """

    Returns:

    """
    data = self._store.copy()

    for key in data:
        if isinstance(data[key], datetime.datetime):
            data[key] = data[key].isoformat()
    return data

EyeVolumeMeta(scale_z, scale_x, scale_y, scale_unit, bscan_meta, **kwargs)

Bases: EyeMeta

A dict with required keys to hold meta data for OCT volumes.

Parameters:

Name Type Description Default
scale_z float

Distance between neighbouring B-scans

required
scale_x float

Horizontal scale of the B-scan pixels

required
scale_y float

Vertical scale of the B-scan pixels

required
scale_unit str

Unit of the scale. e.g. µm if scale is given in µm/pixel

required
bscan_meta list[EyeBscanMeta]

A list holding an EyeBscanMeta object for every B-scan of the volume

required
**kwargs
{}
Source code in src/eyepy/core/eyemeta.py
def __init__(
    self,
    scale_z: float,
    scale_x: float,
    scale_y: float,
    scale_unit: str,
    bscan_meta: list[EyeBscanMeta],
    **kwargs,
):
    """A dict with required keys to hold meta data for OCT volumes.

    Args:
        scale_z: Distance between neighbouring B-scans
        scale_x: Horizontal scale of the B-scan pixels
        scale_y: Vertical scale of the B-scan pixels
        scale_unit: Unit of the scale. e.g. µm if scale is given in µm/pixel
        bscan_meta: A list holding an EyeBscanMeta object for every B-scan of the volume
        **kwargs:
    """
    super().__init__(
        scale_z=scale_z,
        scale_x=scale_x,
        scale_y=scale_y,
        scale_unit=scale_unit,
        bscan_meta=bscan_meta,
        **kwargs,
    )

as_dict()

Returns:

Source code in src/eyepy/core/eyemeta.py
def as_dict(self) -> dict:
    """

    Returns:

    """
    data = super().as_dict()
    data['bscan_meta'] = [bm.as_dict() for bm in data['bscan_meta']]
    return data

from_dict(data) classmethod

Parameters:

Name Type Description Default
data dict
required

Returns:

Source code in src/eyepy/core/eyemeta.py
@classmethod
def from_dict(cls, data: dict) -> 'EyeVolumeMeta':
    """

    Args:
        data:

    Returns:

    """
    data['bscan_meta'] = [EyeBscanMeta(**d) for d in data['bscan_meta']]
    return cls(**data)