Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit e5197d1

Browse files
authored
Allow more channels in metadata than in data (#546)
1 parent cd5a50c commit e5197d1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

aicsimageio/readers/czi_reader.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,18 @@ def _get_coords_and_physical_px_sizes(
557557
# Construct channel name list
558558
scene_channel_list = []
559559
channels = img.findall("./Channel")
560-
for i, channel in enumerate(channels):
560+
number_of_channels_in_data = dims_shape[DimensionNames.Channel][1]
561+
562+
# There may be more channels in the metadata than in the data
563+
# if so, we will just use the first N channels and log
564+
# a warning to the user
565+
if len(channels) > number_of_channels_in_data:
566+
log.warning(
567+
"More channels in metadata than in data "
568+
f"({len(channels)} vs {number_of_channels_in_data})"
569+
)
570+
571+
for i, channel in enumerate(channels[:number_of_channels_in_data]):
561572
# Id is required, Name is not.
562573
# But we prefer to use Name if it is present
563574
channel_name = channel.attrib.get("Name")

0 commit comments

Comments
 (0)