diff --git a/.github/workflows/test_demos.yml b/.github/workflows/test_demos.yml index 585988f3..aba56104 100644 --- a/.github/workflows/test_demos.yml +++ b/.github/workflows/test_demos.yml @@ -11,6 +11,7 @@ jobs: with: python-version: '3.9' - run: | + pip install "pulp==2.7.0" pip install snakemake pip install pyyaml - name: Install vitessce diff --git a/pyproject.toml b/pyproject.toml index d9e9406c..7b3d23bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ 'numpy>=1.21.2', 'anndata>=0.7.8,<0.9', 'scanpy>=1.9.3', - 'ome-zarr==0.2.1', + 'ome-zarr==0.8.3', 'tifffile>=2020.10.1', 'jsonschema>=3.2' ] @@ -50,6 +50,16 @@ dev = [ docs = [ 'sphinx==4.2.0', 'sphinx-rtd-theme==1.0.0', + + # Pin sub-dependencies of sphinx + # Reference: https://github.com/sphinx-doc/sphinx/issues/11130 + 'sphinxcontrib-applehelp==1.0.4', + 'sphinxcontrib-devhelp==1.0.2', + 'sphinxcontrib-htmlhelp==2.0.1', + 'sphinxcontrib-jsmath==1.0.1', + 'sphinxcontrib-qthelp==1.0.3', + 'sphinxcontrib-serializinghtml==1.1.5', + 'nbsphinx==0.8.8', 'nbclean==0.3.2', # Pin sqlalchemy to before 1.4 to fix issue importing nbclean.NotebookCleaner diff --git a/tests/test_ome_utils.py b/tests/test_ome_utils.py index a9d183ef..4eae304f 100644 --- a/tests/test_ome_utils.py +++ b/tests/test_ome_utils.py @@ -50,41 +50,44 @@ def setUp(self): def test_rgb_img_to_ome_zarr(self): img_arr = self.img_arr out_path = data_path / "rgb_out.ome.zarr" - rgb_img_to_ome_zarr(img_arr, out_path, img_name="Test", axes="cyx", chunks=(1, 3, 3)) + rgb_img_to_ome_zarr(img_arr, out_path, img_name="Test", axes="cyx", chunks=(1, 3, 3), scaler=None) z_root = zarr.open(out_path, mode="r") assert dict(z_root.attrs) == { 'multiscales': [ { - 'axes': ['c', 'y', 'x'], + 'axes': [ + {'name': 'c', 'type': 'channel'}, + {'name': 'y', 'type': 'space'}, + {'name': 'x', 'type': 'space'} + ], 'datasets': [ - {'path': '0'}, - {'path': '1'}, - {'path': '2'}, - {'path': '3'}, - {'path': '4'} + { + 'coordinateTransformations': [ + {'scale': [1.0, 1.0, 1.0], 'type': 'scale'} + ], + 'path': '0' + } ], - 'version': '0.3' + 'name': '/', + 'version': '0.4' } ], 'omero': { 'channels': [ - { - 'color': 'FF0000', - 'label': 'R', - 'window': {'end': 255, 'max': 255, 'min': 0, 'start': 0} - }, - { - 'color': '00FF00', - 'label': 'G', - 'window': {'end': 255, 'max': 255, 'min': 0, 'start': 0} - }, - { - 'color': '0000FF', - 'label': 'B', - 'window': {'end': 255, 'max': 255, 'min': 0, 'start': 0} - } + {'color': 'FF0000', + 'label': 'R', + 'window': {'end': 255, 'max': 255, 'min': 0, 'start': 0} + }, + {'color': '00FF00', + 'label': 'G', + 'window': {'end': 255, 'max': 255, 'min': 0, 'start': 0} + }, + {'color': '0000FF', + 'label': 'B', + 'window': {'end': 255, 'max': 255, 'min': 0, 'start': 0} + } ], 'name': 'Test', 'rdefs': {}, diff --git a/vitessce/data_utils/ome.py b/vitessce/data_utils/ome.py index 8f87c33c..633d48b3 100644 --- a/vitessce/data_utils/ome.py +++ b/vitessce/data_utils/ome.py @@ -49,7 +49,7 @@ def multiplex_img_to_ome_tiff(img_arr, channel_names, output_path, axes="CYX"): tiff_writer.close() -def rgb_img_to_ome_zarr(img_arr, output_path, img_name="Image", chunks=(1, 256, 256), axes="cyx"): +def rgb_img_to_ome_zarr(img_arr, output_path, img_name="Image", chunks=(1, 256, 256), axes="cyx", **kwargs): """ Convert an RGB image to OME-Zarr v0.3. @@ -75,30 +75,31 @@ def rgb_img_to_ome_zarr(img_arr, output_path, img_name="Image", chunks=(1, 256, image=img_arr, group=z_root, axes=axes, - omero={ - "name": img_name, - "version": "0.3", - "rdefs": {}, - "channels": [ - { - "label": "R", - "color": "FF0000", - "window": default_window - }, - { - "label": "G", - "color": "00FF00", - "window": default_window - }, - { - "label": "B", - "color": "0000FF", - "window": default_window - } - ] - }, - chunks=chunks + storage_options=dict(chunks=chunks), + **kwargs, ) + z_root.attrs["omero"] = { + "name": img_name, + "version": "0.3", + "rdefs": {}, + "channels": [ + { + "label": "R", + "color": "FF0000", + "window": default_window + }, + { + "label": "G", + "color": "00FF00", + "window": default_window + }, + { + "label": "B", + "color": "0000FF", + "window": default_window + } + ] + } def multiplex_img_to_ome_zarr(img_arr, channel_names, output_path, img_name="Image", chunks=(1, 256, 256), axes="cyx", channel_colors=None): @@ -132,19 +133,19 @@ def multiplex_img_to_ome_zarr(img_arr, channel_names, output_path, img_name="Ima image=img_arr, group=z_root, axes=axes, - omero={ - "name": img_name, - "version": "0.3", - "rdefs": {}, - "channels": [ - { - "label": channel_name, - "color": channel_colors[channel_name] if channel_colors is not None else "FFFFFF", - "window": default_window - } - for channel_name - in channel_names - ] - }, - chunks=chunks + storage_options=dict(chunks=chunks) ) + z_root.attrs["omero"] = { + "name": img_name, + "version": "0.3", + "rdefs": {}, + "channels": [ + { + "label": channel_name, + "color": channel_colors[channel_name] if channel_colors is not None else "FFFFFF", + "window": default_window + } + for channel_name + in channel_names + ] + }