From 067ae94a08cfd82b365b4c6ad8819ae1d1de7f54 Mon Sep 17 00:00:00 2001 From: Andrey Aristov <aaristov@pasteur.fr> Date: Wed, 31 Aug 2022 17:14:23 +0200 Subject: [PATCH] fix tabulation --- src/napari_segment/_reader.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/napari_segment/_reader.py b/src/napari_segment/_reader.py index cb88a94..bb84413 100644 --- a/src/napari_segment/_reader.py +++ b/src/napari_segment/_reader.py @@ -48,16 +48,23 @@ def napari_get_reader(path): def read_zarr(path): - print(f"reading {path}") + print(f"read_zarr {path}") + try: attrs = json.load(open(os.path.join(path, ".zattrs"))) info = attrs["multiscales"]["multiscales"][0] + except Exception as e: + raise e + + dataset_paths = [os.path.join(path, d["path"]) for d in info["datasets"]] + datasets = [dask.array.from_zarr(p) for p in dataset_paths] + + try: channel_axis = info["channel_axis"] print(f"found channel axis {channel_axis}") - dataset_paths = [ - os.path.join(path, d["path"]) for d in info["datasets"] - ] - datasets = [dask.array.from_zarr(p) for p in dataset_paths] + except KeyError: + channel_axis = None + except Exception as e: raise e -- GitLab