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

OME-XML metadata support #47

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 14 additions & 1 deletion napari_ome_zarr/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def napari_get_reader(path: PathLike) -> Optional[ReaderFunction]:
zarr = parse_url(path)
if zarr:
reader = Reader(zarr)
return transform(reader())
rv = transform(reader())
return rv
# Ignoring this path
return None

Expand Down Expand Up @@ -132,7 +133,19 @@ def f(*args: Any, **kwargs: Any) -> List[LayerData]:
data = [
np.squeeze(level, axis=channel_axis) for level in node.data
]
metadata["name"] = [
metadata.get("name", "unnamed") for x in range(3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is range(3) hard-coded for a 3-channel image?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I assume that's what that was about, yes.

]
else:

metadata["name"] = "unnamed"
image = node.metadata.get("ome-xml:image", None)
# Pull from OME-XML metadata
if image:
metadata["name"] = image.name

# Pull from NGFF metadata?
# TBD
# Handle the removal of vispy requirement from ome-zarr-py
cms = node.metadata.get("colormap", [])
for idx, cm in enumerate(cms):
Expand Down