Skip to content

Commit 6c4e504

Browse files
Fix errors caused by zarr
1 parent 261f255 commit 6c4e504

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

environment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ dependencies:
1313
- s3fs
1414
- torch_em
1515
- z5py
16-
- zarr
16+
# Don't install zarr v3, as we are not sure that it is compatible with MoBIE etc. yet
17+
- zarr <3

flamingo_tools/file_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import zarr
88
from elf.io import open_file
99

10+
try:
11+
from zarr.abc.store import Store
12+
except ImportError:
13+
from zarr._storage.store import BaseStore as Store
14+
1015

1116
def _parse_shape(metadata_file):
1217
depth, height, width = None, None, None
@@ -62,7 +67,7 @@ def read_tif(file_path: str) -> Union[np.ndarray, np.memmap]:
6267
return x
6368

6469

65-
def read_image_data(input_path: Union[str, zarr.storage.FSStore], input_key: Optional[str]) -> np.typing.ArrayLike:
70+
def read_image_data(input_path: Union[str, Store], input_key: Optional[str]) -> np.typing.ArrayLike:
6671
"""Read flamingo image data, stored in various formats.
6772
6873
Args:

flamingo_tools/s3_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import s3fs
88
import zarr
99

10+
try:
11+
from zarr.abc.store import Store
12+
except ImportError:
13+
from zarr._storage.store import BaseStore as Store
14+
1015

1116
# Dedicated bucket for cochlea lightsheet project
1217
MOBIE_FOLDER = "/mnt/vast-nhr/projects/nim00007/data/moser/cochlea-lightsheet/mobie_project/cochlea-lightsheet"
@@ -93,7 +98,7 @@ def get_s3_path(
9398
bucket_name: Optional[str] = None,
9499
service_endpoint: Optional[str] = None,
95100
credential_file: Optional[str] = None,
96-
) -> Tuple[zarr.storage.FSStore, s3fs.core.S3FileSystem]:
101+
) -> Tuple[Store, s3fs.core.S3FileSystem]:
97102
"""Get S3 path for a file or folder and file system based on S3 parameters and credentials.
98103
99104
Args:

0 commit comments

Comments
 (0)