Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Only depend on dask-image in pyodide #744

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions itkwidgets/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
Loading