From 2c34ea063f6697a84e0067a4644579680bac8465 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 17 Apr 2024 11:18:20 -0400 Subject: [PATCH] COMP: Only depend on dask-image in pyodide Avoid conflicts with pandas version (Issue #743) and keep light. --- itkwidgets/integrations/__init__.py | 14 +++++++++++--- pyproject.toml | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/itkwidgets/integrations/__init__.py b/itkwidgets/integrations/__init__.py index 8baa204b..a8ebb0cf 100644 --- a/itkwidgets/integrations/__init__.py +++ b/itkwidgets/integrations/__init__.py @@ -10,6 +10,7 @@ from .vtk import HAVE_VTK, vtk_image_to_ngff_image, vtk_polydata_to_vtkjs from .xarray import HAVE_XARRAY, HAVE_MULTISCALE_SPATIAL_IMAGE, xarray_data_array_to_numpy, xarray_data_set_to_numpy from ..render_types import RenderType +from .environment import ENVIRONMENT, Env def _spatial_image_scale_factors(spatial_image, min_length): sizes = dict(spatial_image.sizes) @@ -44,10 +45,17 @@ def _get_viewer_image(image, label=False): return image.store min_length = 64 - if label: - method = Methods.DASK_IMAGE_NEAREST + # ITKWASM methods are currently only async in pyodide + if ENVIRONMENT is Env.JUPYTERLITE: + if label: + method = Methods.DASK_IMAGE_NEAREST + else: + method = Methods.DASK_IMAGE_GAUSSIAN else: - method = Methods.DASK_IMAGE_GAUSSIAN + if label: + method = Methods.ITKWASM_LABEL_IMAGE + else: + method = Methods.ITKWASM_GAUSSIAN store, chunk_store = _make_multiscale_store() diff --git a/pyproject.toml b/pyproject.toml index 05865dce..0873b296 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,8 @@ dependencies = [ "imjoy-rpc >= 0.5.42", "imjoy-utils >= 0.1.2", "importlib_metadata", - "ngff-zarr[dask-image] >= 0.4.3", + "ngff-zarr >= 0.8.1; sys_platform != \"emscripten\"", + "ngff-zarr[dask-image] >= 0.8.1; sys_platform == \"emscripten\"", "numcodecs", "zarr", ]