diff --git a/CHANGELOG.md b/CHANGELOG.md index 371a8b16a..3313cf05e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Improvements - Style can specify a dtype of 'source' to maintain the original dtype even when compositing frames ([#1326](../../pull/1326)) - Max Merge option in Frame Selector ([#1306](../../pull/1306), [#1330](../../pull/1330)) +- Improve tifffile associated image detection ([#1333](../../pull/1333)) ### Changes - Prohibit bioformats and vips from reading mrxs directly ([#1328](../../pull/1328)) diff --git a/large_image/tilesource/utilities.py b/large_image/tilesource/utilities.py index 5f16dad09..8679feb99 100644 --- a/large_image/tilesource/utilities.py +++ b/large_image/tilesource/utilities.py @@ -292,7 +292,7 @@ def _vipsCast(image, mustBe8Bit=False, originalScale=None): if image.format not in formats or (image.format == pyvips.BandFormat.USHORT and not mustBe8Bit): return image target, offset, multiplier = formats[image.format] - if image.format == pyvips.BandFormat.DOUBLE: + if image.format == pyvips.BandFormat.DOUBLE or image.format == pyvips.BandFormat.FLOAT: maxVal = image.max() # These thresholds are higher than 256 and 65536 because bicubic and # other interpolations can cause value spikes diff --git a/sources/tifffile/large_image_source_tifffile/__init__.py b/sources/tifffile/large_image_source_tifffile/__init__.py index 0fd7c7b0d..af1c7ea37 100644 --- a/sources/tifffile/large_image_source_tifffile/__init__.py +++ b/sources/tifffile/large_image_source_tifffile/__init__.py @@ -240,10 +240,11 @@ def _findAssociatedImages(self): Find associated images from unused pages and series. """ pagesInSeries = [p for s in self._tf.series for ll in s.pages.levels for p in ll.pages] + hashes = [p.hash for p in pagesInSeries if p.keyframe is not None] self._associatedImages = {} for p in self._tf.pages: if (p not in pagesInSeries and p.keyframe is not None and - not len(set(p.axes) - set('YXS'))): + p.hash not in hashes and not len(set(p.axes) - set('YXS'))): id = 'image_%s' % p.index entry = {'page': p.index} entry['width'] = p.shape[p.axes.index('X')]