|
3 | 3 |
|
4 | 4 | import pytest |
5 | 5 | import zarr |
| 6 | +from dask_image import imread |
6 | 7 |
|
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 | +) |
8 | 16 |
|
9 | 17 | from ._data import verify_against_baseline |
10 | 18 |
|
@@ -47,3 +55,24 @@ def test_gaussian_isotropic_scale_factors(input_images): |
47 | 55 | to_ngff_zarr(tmpdir, multiscales, use_tensorstore=True) |
48 | 56 | multiscales = from_ngff_zarr(tmpdir) |
49 | 57 | 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