Skip to content

Commit 0c83dd2

Browse files
committed
BUG: Additional fixes following python 3.7 backport
1 parent ecaa868 commit 0c83dd2

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

itkwidgets/integrations/__init__.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ def _get_viewer_image(image, label=False):
4747
method = Methods.DASK_IMAGE_NEAREST
4848
else:
4949
method = Methods.DASK_IMAGE_GAUSSIAN
50-
50+
5151
store, chunk_store = _make_multiscale_store()
5252

5353
if HAVE_MULTISCALE_SPATIAL_IMAGE:
54+
from multiscale_spatial_image import MultiscaleSpatialImage
5455
if isinstance(image, MultiscaleSpatialImage):
5556
image.to_zarr(store, compute=True)
5657
return store
@@ -59,6 +60,7 @@ def _get_viewer_image(image, label=False):
5960
ngff_image = itk_image_to_ngff_image(image)
6061
multiscales = to_multiscales(ngff_image, method=method)
6162
to_ngff_zarr(store, multiscales, chunk_store=chunk_store)
63+
return store
6264

6365
if HAVE_ITK:
6466
import itk
@@ -152,10 +154,6 @@ def _detect_render_type(data, input_type) -> RenderType:
152154
return RenderType.IMAGE
153155
elif isinstance(data, itkwasm.PointSet):
154156
return RenderType.POINT_SET
155-
elif HAVE_MULTISCALE_SPATIAL_IMAGE:
156-
from multiscale_spatial_image import MultiscaleSpatialImage
157-
if isinstance(data, MultiscaleSpatialImage):
158-
return RenderType.IMAGE
159157
elif isinstance(data, (zarr.Array, zarr.Group)):
160158
# For now assume zarr.Group is an image
161159
# In the future, once NGFF supports point sets fully
@@ -175,6 +173,10 @@ def _detect_render_type(data, input_type) -> RenderType:
175173
import itk
176174
if isinstance(data, itk.Image):
177175
return RenderType.IMAGE
176+
if HAVE_MULTISCALE_SPATIAL_IMAGE:
177+
from multiscale_spatial_image import MultiscaleSpatialImage
178+
if isinstance(data, MultiscaleSpatialImage):
179+
return RenderType.IMAGE
178180
if HAVE_VTK:
179181
import vtk
180182
if isinstance(data, vtk.vtkImageData):
@@ -200,8 +202,8 @@ def _detect_render_type(data, input_type) -> RenderType:
200202
return RenderType.POINT_SET
201203
else:
202204
return RenderType.IMAGE
203-
if isinstance(data, xr.Dataset):
204-
if input_type == 'point_sets':
205-
return RenderType.POINT_SET
206-
else:
207-
return RenderType.IMAGE
205+
if isinstance(data, xr.Dataset):
206+
if input_type == 'point_sets':
207+
return RenderType.POINT_SET
208+
else:
209+
return RenderType.IMAGE

0 commit comments

Comments
 (0)