Skip to content

Commit 2c34ea0

Browse files
committed
COMP: Only depend on dask-image in pyodide
Avoid conflicts with pandas version (Issue #743) and keep light.
1 parent 1018156 commit 2c34ea0

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

itkwidgets/integrations/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .vtk import HAVE_VTK, vtk_image_to_ngff_image, vtk_polydata_to_vtkjs
1111
from .xarray import HAVE_XARRAY, HAVE_MULTISCALE_SPATIAL_IMAGE, xarray_data_array_to_numpy, xarray_data_set_to_numpy
1212
from ..render_types import RenderType
13+
from .environment import ENVIRONMENT, Env
1314

1415
def _spatial_image_scale_factors(spatial_image, min_length):
1516
sizes = dict(spatial_image.sizes)
@@ -44,10 +45,17 @@ def _get_viewer_image(image, label=False):
4445
return image.store
4546

4647
min_length = 64
47-
if label:
48-
method = Methods.DASK_IMAGE_NEAREST
48+
# ITKWASM methods are currently only async in pyodide
49+
if ENVIRONMENT is Env.JUPYTERLITE:
50+
if label:
51+
method = Methods.DASK_IMAGE_NEAREST
52+
else:
53+
method = Methods.DASK_IMAGE_GAUSSIAN
4954
else:
50-
method = Methods.DASK_IMAGE_GAUSSIAN
55+
if label:
56+
method = Methods.ITKWASM_LABEL_IMAGE
57+
else:
58+
method = Methods.ITKWASM_GAUSSIAN
5159

5260
store, chunk_store = _make_multiscale_store()
5361

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ dependencies = [
4040
"imjoy-rpc >= 0.5.42",
4141
"imjoy-utils >= 0.1.2",
4242
"importlib_metadata",
43-
"ngff-zarr[dask-image] >= 0.4.3",
43+
"ngff-zarr >= 0.8.1; sys_platform != \"emscripten\"",
44+
"ngff-zarr[dask-image] >= 0.8.1; sys_platform == \"emscripten\"",
4445
"numcodecs",
4546
"zarr",
4647
]

0 commit comments

Comments
 (0)