Skip to content

Commit a5e5220

Browse files
authored
Merge pull request #111 from thewtex/tensorstore-test-large-serialization
ENH: Add a test for large image serialization with tensorstore
2 parents cbc999a + bbd2dae commit a5e5220

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

test/test_to_ngff_zarr_tensorstore.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33

44
import pytest
55
import zarr
6+
from dask_image import imread
67

7-
from ngff_zarr import Methods, to_multiscales, to_ngff_zarr, from_ngff_zarr
8+
from ngff_zarr import (
9+
Methods,
10+
to_multiscales,
11+
to_ngff_zarr,
12+
from_ngff_zarr,
13+
config,
14+
to_ngff_image,
15+
)
816

917
from ._data import verify_against_baseline
1018

@@ -47,3 +55,24 @@ def test_gaussian_isotropic_scale_factors(input_images):
4755
to_ngff_zarr(tmpdir, multiscales, use_tensorstore=True)
4856
multiscales = from_ngff_zarr(tmpdir)
4957
verify_against_baseline(dataset_name, baseline_name, multiscales)
58+
59+
60+
def test_large_image_serialization(input_images):
61+
pytest.importorskip("tensorstore")
62+
63+
default_mem_target = config.memory_target
64+
config.memory_target = int(1e6)
65+
66+
dataset_name = "lung_series"
67+
data = imread.imread(input_images[dataset_name])
68+
image = to_ngff_image(
69+
data=data,
70+
dims=("z", "y", "x"),
71+
scale={"z": 2.5, "y": 1.40625, "x": 1.40625},
72+
translation={"z": 332.5, "y": 360.0, "x": 0.0},
73+
name="LIDC2",
74+
)
75+
multiscales = to_multiscales(image)
76+
with tempfile.TemporaryDirectory() as tmpdir:
77+
to_ngff_zarr(tmpdir, multiscales, use_tensorstore=True)
78+
config.memory_target = default_mem_target

0 commit comments

Comments
 (0)