Skip to content

Commit 8c87a3a

Browse files
Add more val functions
1 parent c5a3d9c commit 8c87a3a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

flamingo_tools/validation.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ def _normalize_cochlea_name(name):
2727
return f"{prefix}_{number:06d}_{postfix}"
2828

2929

30+
def parse_annotation_path(annotation_path):
31+
fname = os.path.basename(annotation_path)
32+
name_parts = fname.split("_")
33+
cochlea = _normalize_cochlea_name(name_parts[0])
34+
slice_id = int(name_parts[2][1:])
35+
return cochlea, slice_id
36+
37+
3038
# TODO enable table component filtering with MoBIE table
3139
# NOTE: the main component is always #1
3240
def fetch_data_for_evaluation(
@@ -54,10 +62,7 @@ def fetch_data_for_evaluation(
5462
return segmentation, annotations
5563

5664
# Parse which ID and which cochlea from the name.
57-
fname = os.path.basename(annotation_path)
58-
name_parts = fname.split("_")
59-
cochlea = _normalize_cochlea_name(name_parts[0])
60-
slice_id = int(name_parts[2][1:])
65+
cochlea, slice_id = parse_annotation_path(annotation_path)
6166

6267
# Open the S3 connection, get the path to the SGN segmentation in S3.
6368
internal_path = os.path.join(cochlea, "images", "ome-zarr", f"{seg_name}.ome.zarr")

0 commit comments

Comments
 (0)