Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using LocalStore in Zarr v3 #8299

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests/test_zarr_avg_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@
from torch.nn.functional import pad

from monai.inferers import ZarrAvgMerger
from monai.utils import optional_import
from monai.utils import get_package_version, optional_import, version_geq
from tests.utils import assert_allclose

np.seterr(divide="ignore", invalid="ignore")
zarr, has_zarr = optional_import("zarr")
if has_zarr:
if version_geq(get_package_version("zarr"), "3.0.0"):
directory_store = zarr.storage.LocalStore("test.zarr")
else:
directory_store = zarr.storage.DirectoryStore("test.zarr")
KumoLiu marked this conversation as resolved.
Show resolved Hide resolved
else:
directory_store = None
numcodecs, has_numcodecs = optional_import("numcodecs")

TENSOR_4x4 = torch.randint(low=0, high=255, size=(2, 3, 4, 4), dtype=torch.float32)
Expand Down Expand Up @@ -154,7 +161,7 @@

# explicit directory store
TEST_CASE_10_DIRECTORY_STORE = [
dict(merged_shape=TENSOR_4x4.shape, store=zarr.storage.DirectoryStore("test.zarr")),
dict(merged_shape=TENSOR_4x4.shape, store=directory_store),
[
(TENSOR_4x4[..., :2, :2], (0, 0)),
(TENSOR_4x4[..., :2, 2:], (0, 2)),
Expand Down
Loading