From 8db8a550d054aeb48964516aab846954f10208ed Mon Sep 17 00:00:00 2001 From: David Manthey Date: Thu, 9 Sep 2021 11:52:12 -0400 Subject: [PATCH] Band interpretation for high bands errored. If there were more than four bands and the band interpretation is not known, an error was thrown instead of returning `unknown`. --- CHANGELOG.md | 5 +++++ large_image/tilesource/base.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a7cad5e6..91c8cd2fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## Unreleased + +### Bug Fixes +- getBandInformation could fail on high bands in some cases + ## Version 1.8.0 ### Features diff --git a/large_image/tilesource/base.py b/large_image/tilesource/base.py index 81182a2b4..09bb84843 100644 --- a/large_image/tilesource/base.py +++ b/large_image/tilesource/base.py @@ -1344,7 +1344,7 @@ def getBandInformation(self, statistics=False, **kwargs): if not getattr(self, '_bandInfoNoStats', None): tile = self.getSingleTile()['tile'] bands = tile.shape[2] if len(tile.shape) > 2 else 1 - interp = bandInterp.get(bands, 3) + interp = bandInterp.get(bands, bandInterp[3]) bandInfo = [{'interpretation': interp[idx] if idx < len(interp) else 'unknown'} for idx in range(bands)] self._bandInfoNoStats = bandInfo