Skip to content

Commit

Permalink
Corrected group data parsing from zarr files
Browse files Browse the repository at this point in the history
  • Loading branch information
fercer committed Oct 28, 2024
1 parent 2666e5c commit afba9a5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/napari_activelearning/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,12 @@ def get_source_data(layer: Layer):
range(len(input_filename_parts))))
if extension_idx:
extension_idx = extension_idx[0]
data_group = Path(
*input_filename_parts[extension_idx + 1:]
)
data_group = input_filename_parts[extension_idx + 1:]
if len(data_group):
data_group = Path(*data_group)
else:
data_group = ""

input_path = Path(
*input_filename_parts[:extension_idx + 1]
)
Expand All @@ -520,14 +523,9 @@ def get_source_data(layer: Layer):
input_filename = input_scheme + input_netloc + input_path

if ".zarr" in input_filename:
if data_group:
data_group = Path(data_group)

z_grp = zarr.open(input_filename, mode="r")
while not isinstance(z_grp[str(data_group)], zarr.Array):
data_group = data_group / "0"

data_group = str(data_group)
while not isinstance(z_grp[data_group], zarr.Array):
data_group = str(Path(data_group) / "0")

else:
return layer.data, None
Expand Down

0 comments on commit afba9a5

Please sign in to comment.