From 40bbd33436615692e9b1911edb95293a0ca2dafc Mon Sep 17 00:00:00 2001 From: David Manthey Date: Tue, 13 Apr 2021 14:51:54 -0400 Subject: [PATCH] Handle OME Tiff files with odd tile sizes. Have files where where lower levels report a tile size equal to the image size instead of the regular tile size. --- CHANGELOG.md | 2 +- sources/ometiff/large_image_source_ometiff/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae43e83e8..61497553a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ - More untiled tiff files are handles by the bioformats reader (#569) - Expose a concurrent option on endpoints for converting images (#583) - Better concurrency use in image conversion (#587) -- Handle more OME tiffs (#585) +- Handle more OME tiffs (#585, #591) ### Changes - Exceptions on cached items are no longer within the KeyError context (#584) diff --git a/sources/ometiff/large_image_source_ometiff/__init__.py b/sources/ometiff/large_image_source_ometiff/__init__.py index ef6931678..4668da9bd 100644 --- a/sources/ometiff/large_image_source_ometiff/__init__.py +++ b/sources/ometiff/large_image_source_ometiff/__init__.py @@ -311,7 +311,8 @@ def getTile(self, x, y, z, pilImageAllowed=False, numpyAllowed=False, if subdir: scale = int(2 ** subdir) if (dir is None or - dir.tileWidth != self.tileWidth or dir.tileHeight != self.tileHeight or + (dir.tileWidth != self.tileWidth and dir.tileWidth != dir.imageWidth) or + (dir.tileHeight != self.tileHeight and dir.tileHeight != dir.imageHeight) or abs(dir.imageWidth * scale - self.sizeX) > scale or abs(dir.imageHeight * scale - self.sizeY) > scale): return super().getTile(