|
1 | 1 | import itkwasm |
2 | 2 | import numpy as np |
3 | 3 | import zarr |
4 | | -from ngff_zarr import to_multiscales, to_ngff_zarr, to_ngff_image, itk_image_to_ngff_image, Methods |
| 4 | +from ngff_zarr import to_multiscales, to_ngff_zarr, to_ngff_image, itk_image_to_ngff_image, Methods, NgffImage, Multiscales |
5 | 5 |
|
6 | 6 | import dask |
7 | 7 | from .itk import HAVE_ITK, itk_group_spatial_object_to_wasm_point_set |
@@ -50,6 +50,15 @@ def _get_viewer_image(image, label=False): |
50 | 50 |
|
51 | 51 | store, chunk_store = _make_multiscale_store() |
52 | 52 |
|
| 53 | + if isinstance(image, NgffImage): |
| 54 | + multiscales = to_multiscales(image, method=method) |
| 55 | + to_ngff_zarr(store, multiscales, chunk_store=chunk_store) |
| 56 | + return store |
| 57 | + |
| 58 | + if isinstance(image, Multiscales): |
| 59 | + to_ngff_zarr(store, image, chunk_store=chunk_store) |
| 60 | + return store |
| 61 | + |
53 | 62 | if HAVE_MULTISCALE_SPATIAL_IMAGE: |
54 | 63 | from multiscale_spatial_image import MultiscaleSpatialImage |
55 | 64 | if isinstance(image, MultiscaleSpatialImage): |
@@ -160,6 +169,10 @@ def _detect_render_type(data, input_type) -> RenderType: |
160 | 169 | return RenderType.POINT_SET |
161 | 170 | if isinstance(data, itkwasm.Image): |
162 | 171 | return RenderType.IMAGE |
| 172 | + elif isinstance(data, NgffImage): |
| 173 | + return RenderType.IMAGE |
| 174 | + elif isinstance(data, Multiscales): |
| 175 | + return RenderType.IMAGE |
163 | 176 | elif isinstance(data, itkwasm.PointSet): |
164 | 177 | return RenderType.POINT_SET |
165 | 178 | elif isinstance(data, (zarr.Array, zarr.Group)): |
|
0 commit comments