Skip to content

Commit

Permalink
Adds option to extract apparent e2e fundus repeats
Browse files Browse the repository at this point in the history
  • Loading branch information
marksgraham committed Nov 13, 2023
1 parent f7963d0 commit e1fde01
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion oct_converter/readers/e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,14 @@ def _make_lut():

return oct_volumes

def read_fundus_image(self) -> list[FundusImageWithMetaData]:
def read_fundus_image(
self, extract_scan_repeats: bool = False
) -> list[FundusImageWithMetaData]:
"""Reads fundus data.
Args:
extract_scan_repeats: if True, extract all fundus images, including those that appear repeated. Defaults to False.
Returns:
A sequence of FundusImageWithMetaData.
"""
Expand Down Expand Up @@ -360,9 +365,20 @@ def read_fundus_image(self) -> list[FundusImageWithMetaData]:
image = np.array(raw_volume).reshape(
image_data.height, image_data.width
)

image_string = "{}_{}_{}".format(
chunk.patient_db_id, chunk.study_id, chunk.series_id
)
if (
image_string in image_array_dict.keys()
and extract_scan_repeats
):
is_in_keys = True
while is_in_keys:
image_string = image_string + "_"
if image_string not in image_array_dict.keys():
is_in_keys = False

image_array_dict[image_string] = image
# here assumes laterality stored in chunk before the image itself
laterality_dict[image_string] = laterality
Expand Down

0 comments on commit e1fde01

Please sign in to comment.