Skip to content

Commit d4aa341

Browse files
committed
ENH: Add a test for large image serialization with tensorstore
1 parent cbc999a commit d4aa341

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

test/test_to_ngff_zarr_tensorstore.py

Lines changed: 28 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,22 @@ 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+
default_mem_target = config.memory_target
62+
config.memory_target = int(1e6)
63+
64+
dataset_name = "lung_series"
65+
data = imread.imread(input_images[dataset_name])
66+
image = to_ngff_image(
67+
data=data,
68+
dims=("z", "y", "x"),
69+
scale={"z": 2.5, "y": 1.40625, "x": 1.40625},
70+
translation={"z": 332.5, "y": 360.0, "x": 0.0},
71+
name="LIDC2",
72+
)
73+
multiscales = to_multiscales(image)
74+
with tempfile.TemporaryDirectory() as tmpdir:
75+
to_ngff_zarr(tmpdir, multiscales, use_tensorstore=True)
76+
config.memory_target = default_mem_target

0 commit comments

Comments
 (0)