diff --git a/CHANGELOG.md b/CHANGELOG.md index 7911c0e5a..59b27a1b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Show a frame slider when appropriate in jupyter widgets ([#1595](../../pull/1595)) - Improve options for creating or check large images for each item in a folder ([#1586](../../pull/1586)) - Add a lock to avoid mongo excessively computing random numbers ([#1601](../../pull/1601)) +- Better merge source channel names in multi source ([#1605](../../pull/1605)) ### Bug Fixes diff --git a/sources/multi/large_image_source_multi/__init__.py b/sources/multi/large_image_source_multi/__init__.py index 1d9743b57..ac1635397 100644 --- a/sources/multi/large_image_source_multi/__init__.py +++ b/sources/multi/large_image_source_multi/__init__.py @@ -684,9 +684,15 @@ def _addSourceToFrames(self, tsMeta, source, sourceIdx, frameDict): aKey = tuple(self._axisKey(source, frame.get(f'Index{axis.upper()}') or 0, axis) for axis in self._axesList) channel = channels[cIdx] if cIdx < len(channels) else None + # We add the channel name to our channel list if the individual + # source lists the channel name or a set of channels OR the source + # appends channels to an existing set. if channel and channel not in self._channels and ( - 'channel' in source or 'channels' in source): + 'channel' in source or 'channels' in source or + len(self._channels) == aKey[0]): self._channels.append(channel) + # Adjust the channel number if the source named the channel; do not + # do so in other cases if (channel and channel in self._channels and 'c' not in source and 'cValues' not in source): aKey = tuple([self._channels.index(channel)] + list(aKey[1:]))