Skip to content

Commit

Permalink
Fix name metadata from channel_names
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Jul 11, 2024
1 parent 003b7be commit f604ed8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions napari_ome_zarr/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def f(*args: Any, **kwargs: Any) -> List[LayerData]:
for x in METADATA_KEYS:
if x in node.metadata:
metadata[x] = node.metadata[x]
# overwrite 'name' if we have 'channel_names'
if "channel_names" in node.metadata:
metadata["name"] = node.metadata["channel_names"]
else:
# single channel image, so metadata just needs
# single items (not lists)
Expand All @@ -163,6 +166,10 @@ def f(*args: Any, **kwargs: Any) -> List[LayerData]:
metadata[x] = node.metadata[x][0]
except Exception:
pass
# overwrite 'name' if we have 'channel_names'
if "channel_names" in node.metadata:
if len(node.metadata["channel_names"]) > 0:
metadata["name"] = node.metadata["channel_names"][0]

properties = transform_properties(node.metadata.get("properties"))
if properties is not None:
Expand Down

0 comments on commit f604ed8

Please sign in to comment.