eyepy.core.annotations
EyeBscanLayerAnnotation(eyevolumelayerannotation, index)
Layer annotation for a single B-scan.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
eyevolumelayerannotation |
EyeVolumeLayerAnnotation
|
EyeVolumeLayerAnnotation object |
required |
index |
int
|
Index of the B-scan |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
data: npt.NDArray[np.float_]
property
writable
Layer heights.
knots: list
property
writable
Knots parameterizing the layer heights.
name: str
property
writable
Name of the layer annotation.
EyeEnfacePixelAnnotation(enface, data=None, meta=None, **kwargs)
Pixel annotation for an enface image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enface |
EyeEnface
|
EyeEnface object |
required |
data |
Optional[NDArray[bool_]]
|
Pixel annotation data |
None
|
meta |
Optional[dict]
|
Metadata |
None
|
**kwargs |
Additional metadata specified as keyword arguments |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
name: str
property
writable
Name of the pixel annotation.
EyeVolumeLayerAnnotation(volume, data=None, meta=None, **kwargs)
Layer annotation for a single layer in an EyeVolume.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
volume |
EyeVolume
|
EyeVolume object |
required |
data |
Optional[NDArray[float_]]
|
2D array of shape (n_bscans, bscan_width) holding layer height values |
None
|
meta |
Optional[dict]
|
dict with additional meta data |
None
|
**kwargs |
additional meta data specified as parameters |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
knots: dict
property
Knots parameterizing the layer.
name: str
property
writable
Layer name.
layer_indices()
Returns pixel indices of the layer in the volume.
While the layer is stored as the offset from the bottom of the OCT volume, some applications require layer discretized to voxel positions. This method returns the layer as indices into the OCT volume.
The indices can be used for example to create layer maps for semantic segmentation.
import matplotlib.pyplot as plt
import numpy as np
import eyepy as ep
eye_volume = ep.data.load("drusen_patient")
rpe_annotation = eye_volume.layers["RPE"]
rpe_indices = rpe_annotation.layer_indices()
rpe_map = np.zeros(eye_volume.shape)
rpe_map[rpe_indices] = 1
plt.imshow(rpe_map[0]) # (1)
- Visualize layer map for the first B-scan
Returns:
Type | Description |
---|---|
tuple[ndarray, ndarray, ndarray]
|
A tuple with indices for the layers position in the volume - Tuple[bscan_indices, row_indices, column_indices] |
Source code in src/eyepy/core/annotations.py
EyeVolumePixelAnnotation(volume, data=None, meta=None, radii=(1.5, 2.5), n_sectors=(1, 4), offsets=(0, 45), center=None, **kwargs)
Pixel annotation for an EyeVolume.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
volume |
EyeVolume
|
EyeVolume object |
required |
data |
Optional[NDArray[bool_]]
|
3D array of shape (n_bscans, bscan_height, bscan_width) holding boolean pixel annotations |
None
|
meta |
Optional[dict]
|
dict with additional meta data |
None
|
radii |
Iterable[float]
|
radii for quantification on circular grid |
(1.5, 2.5)
|
n_sectors |
Iterable[int]
|
number of sectors for quantification on circular grid |
(1, 4)
|
offsets |
Iterable[int]
|
offsets from x axis for first sector, for quantification on circular grid |
(0, 45)
|
center |
Optional[tuple[float, float]]
|
center of circular grid for quantification |
None
|
**kwargs |
additional meta data specified as parameters |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
center: tuple[float, float]
property
writable
Center of circular grid for quantification.
enface: np.ndarray
property
Transformed projection of the annotation to the enface plane.
masks: dict[str, np.ndarray]
property
Masks for quantification on circular grid.
Returns:
Type | Description |
---|---|
dict[str, ndarray]
|
A dictionary of masks with the keys being the names of the masks. |
n_sectors: Iterable[int]
property
writable
Number of sectors for quantification on circular grid.
name: str
property
writable
Annotation name.
offsets: Iterable[int]
property
writable
Offsets from x axis for first sector, for quantification on circular grid.
projection: np.ndarray
property
Projection of the annotation to the enface plane.
quantification: dict[str, Union[float, str]]
property
Quantification of the annotation on the specified circular grid.
Returns:
Type | Description |
---|---|
dict[str, Union[float, str]]
|
A dictionary of quantifications with the keys being the names of the regions. |
radii: Iterable[float]
property
writable
Radii for quantification on circular grid.
plot(ax=None, region=np.s_[:, :], cmap='Reds', vmin=None, vmax=None, cbar=True, alpha=1)
Plot the annotation on the enface plane.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Optional[Axes]
|
matplotlib axes object |
None
|
region |
Union[slice, tuple[slice, slice]]
|
region of the enface projection to plot |
s_[:, :]
|
cmap |
Union[str, Colormap]
|
colormap |
'Reds'
|
vmin |
Optional[float]
|
minimum value for colorbar |
None
|
vmax |
Optional[float]
|
maximum value for colorbar |
None
|
cbar |
bool
|
whether to plot a colorbar |
True
|
alpha |
float
|
alpha value for the annotation |
1
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
plot_quantification(ax=None, region=np.s_[:, :], alpha=0.5, vmin=None, vmax=None, cbar=True, cmap='YlOrRd')
Plot circular grid quantification of the annotation (like ETDRS)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Optional[Axes]
|
Matplotlib axes to plot on |
None
|
region |
Union[slice, tuple[slice, slice]]
|
Region to plot |
s_[:, :]
|
alpha |
float
|
Alpha value of the mask |
0.5
|
vmin |
Optional[float]
|
Minimum value for the colorbar |
None
|
vmax |
Optional[float]
|
Maximum value for the colorbar |
None
|
cbar |
bool
|
Whether to plot a colorbar |
True
|
cmap |
Union[str, Colormap]
|
Colormap to use |
'YlOrRd'
|
Returns:
Type | Description |
---|---|
None
|
None |