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
property
writable
Layer heights.
knots
property
writable
Knots parameterizing the layer heights.
name
property
writable
Name of the layer annotation.
EyeBscanSlabAnnotation(eyevolumeslabannotation, index)
Slab annotation for a single B-scan.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
eyevolumeslabannotation
|
EyeVolumeSlabAnnotation
|
EyeVolumeSlabAnnotation object |
required |
index
|
int
|
Index of the B-scan |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
mask
property
writable
Mask of the slab in the B-scan.
name
property
writable
Name of the slab 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
|
Any
|
Additional metadata specified as keyword arguments |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
name
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[float64]]
|
2D array of shape (n_bscans, bscan_width) holding layer height values |
None
|
meta
|
Optional[dict]
|
dict with additional meta data |
None
|
**kwargs
|
Any
|
additional meta data specified as parameters |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
knots
property
Knots parameterizing the layer.
name
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
|
Any
|
additional meta data specified as parameters |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/eyepy/core/annotations.py
center
property
writable
Center of circular grid for quantification.
enface
property
Transformed projection of the annotation to the enface plane.
masks
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
property
writable
Number of sectors for quantification on circular grid.
name
property
writable
Annotation name.
offsets
property
writable
Offsets from x axis for first sector, for quantification on circular grid.
projection
property
Projection of the annotation to the enface plane.
quantification
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
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 |
Source code in src/eyepy/core/annotations.py
EyeVolumeSlabAnnotation(volume, meta=None, **kwargs)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
volume
|
EyeVolume
|
An EyeVolume object |
required |
meta
|
Optional[dict]
|
dict with additional meta data |
None
|
**kwargs
|
Any
|
additional meta data as keyword arguments |
{}
|
Source code in src/eyepy/core/annotations.py
bottom_layer
property
writable
Bottom layer name/acronym.
enface
property
Transformed projection of the annotation to the enface plane.
mask
property
Mask of the slab in the volume.
name
property
writable
Slab name.
projection
property
Projection of the data within the slab mask to the enface plane.
top_layer
property
writable
Top layer name/acronym.
apply_contrast(enface, contrast)
Apply contrast to the enface projection.
Source code in src/eyepy/core/annotations.py
plot(ax=None, region=np.s_[:, :], cmap='Greys_r', vmin=None, vmax=None, cbar=False, alpha=1, contrast=None, par=None, transform=False, **kwargs)
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 |
'Greys_r'
|
vmin
|
Optional[float]
|
minimum value for colorbar |
None
|
vmax
|
Optional[float]
|
maximum value for colorbar |
None
|
cbar
|
bool
|
whether to plot a colorbar |
False
|
alpha
|
float
|
alpha value for the annotation |
1
|
contrast
|
Union[int, Literal['auto']]
|
contrast value for the annotation |
None
|
par
|
bool
|
whether to apply Projection Artifact Removal (PAR) to the enface projection |
None
|
transform
|
bool
|
whether to apply the localizer transform to the enface projection |
False
|
Returns:
Type | Description |
---|---|
None
|
None |