Skip to content

Commit

Permalink
layer_indices and enface filename
Browse files Browse the repository at this point in the history
  • Loading branch information
Oli4 committed Sep 17, 2020
1 parent 5e0aa32 commit 2ee6f41
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
14 changes: 14 additions & 0 deletions eyepy/core/octbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ class Bscan:
def __init__(self, index, oct_volume):
self._index = index
self._oct_volume = oct_volume
self._layer_indices = None
self._drusen = None
self._drusen_raw = None

Expand Down Expand Up @@ -417,6 +418,19 @@ def scan_raw(self):
"""
raise NotImplementedError()

@property
def layer_indices(self):
if self._layer_indices is None:

self._layer_indices = {}
for key, layer_height in self.layers.items():
nan_indices = np.isnan(layer_height)
col_indices = np.arange(self.shape[1])[~nan_indices]
row_indices = np.rint(layer_height).astype(int)[~nan_indices]
self._layer_indices[key] = (row_indices, col_indices)

return self._layer_indices

@property
@abstractmethod
def layers(self):
Expand Down
15 changes: 11 additions & 4 deletions eyepy/io/heyex/he_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,22 @@ def __init__(self, filepath, oct_meta=None):

self.shape = (self.oct_meta.SizeXSlo, self.oct_meta.SizeYSlo)
self._size = self.shape[0] * self.shape[1]
self._filename = None

@property
def filename(self):
if self._filename is None:
localizer_path = self._root[0].find(".//ImageType[Type='LOCALIZER']../ImageData/ExamURL").text
self._filename = localizer_path.split("\\")[-1]
return self._filename


@property
def data(self):
if self._data is None:
localizer_path = self._root[0].find(
".//ImageType[Type='LOCALIZER']../ImageData/ExamURL").text
localizer_name = localizer_path.split("\\")[-1]

self._data = imageio.imread(
self._xmlfilepath.parent / localizer_name)
self._xmlfilepath.parent / self.filename)
return self._data

@property
Expand Down

0 comments on commit 2ee6f41

Please sign in to comment.