Skip to content

Commit

Permalink
Allow more channels in metadata than in data (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanLeRoy authored Nov 21, 2023
1 parent cd5a50c commit e5197d1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion aicsimageio/readers/czi_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,18 @@ def _get_coords_and_physical_px_sizes(
# Construct channel name list
scene_channel_list = []
channels = img.findall("./Channel")
for i, channel in enumerate(channels):
number_of_channels_in_data = dims_shape[DimensionNames.Channel][1]

# There may be more channels in the metadata than in the data
# if so, we will just use the first N channels and log
# a warning to the user
if len(channels) > number_of_channels_in_data:
log.warning(
"More channels in metadata than in data "
f"({len(channels)} vs {number_of_channels_in_data})"
)

for i, channel in enumerate(channels[:number_of_channels_in_data]):
# Id is required, Name is not.
# But we prefer to use Name if it is present
channel_name = channel.attrib.get("Name")
Expand Down

0 comments on commit e5197d1

Please sign in to comment.