Skip to content

Commit fcdfa9f

Browse files
authored
Merge pull request #635 from thewtex/ngff-zarr
Ngff zarr
2 parents c1c38d5 + a6f8ab6 commit fcdfa9f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

itkwidgets/integrations/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import itkwasm
22
import numpy as np
33
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
55

66
import dask
77
from .itk import HAVE_ITK, itk_group_spatial_object_to_wasm_point_set
@@ -50,6 +50,15 @@ def _get_viewer_image(image, label=False):
5050

5151
store, chunk_store = _make_multiscale_store()
5252

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+
5362
if HAVE_MULTISCALE_SPATIAL_IMAGE:
5463
from multiscale_spatial_image import MultiscaleSpatialImage
5564
if isinstance(image, MultiscaleSpatialImage):
@@ -160,6 +169,10 @@ def _detect_render_type(data, input_type) -> RenderType:
160169
return RenderType.POINT_SET
161170
if isinstance(data, itkwasm.Image):
162171
return RenderType.IMAGE
172+
elif isinstance(data, NgffImage):
173+
return RenderType.IMAGE
174+
elif isinstance(data, Multiscales):
175+
return RenderType.IMAGE
163176
elif isinstance(data, itkwasm.PointSet):
164177
return RenderType.POINT_SET
165178
elif isinstance(data, (zarr.Array, zarr.Group)):

0 commit comments

Comments
 (0)