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

napari 0.5 support #389

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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
10 changes: 9 additions & 1 deletion ome_zarr/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import math
from abc import ABC
from importlib.metadata import PackageNotFoundError, version
from typing import Any, Dict, Iterator, List, Optional, Type, Union, cast, overload

import dask.array as da
Expand Down Expand Up @@ -253,12 +254,19 @@ def __init__(self, node: Node) -> None:
del properties[label_val]["label-value"]

# TODO: a metadata transform should be provided by specific impls.
try:
napari_version = tuple(
map(int, list(version("napari").split(".")[:2]))
) # major and minor versions as int
except PackageNotFoundError:
napari_version = (0, 5) # default to 0.5+ if not installed
colormap_key = "colormap" if napari_version >= (0, 5) else "color"
name = self.zarr.basename()
node.metadata.update(
{
"visible": node.visible,
"name": name,
"color": colors,
colormap_key: colors,
"metadata": {"image": self.lookup("image", {}), "path": name},
}
)
Expand Down
Loading