From 084bb062a48da75b6b4d100a6fc8ba5c74127bd3 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Thu, 9 Nov 2023 12:13:00 -0500 Subject: [PATCH] Only keep bioformats series that are the same dimensions. --- CHANGELOG.md | 2 +- .../bioformats/large_image_source_bioformats/__init__.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceb2ce4a1..e6a6bfc45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ### Bug Fixes - Default to "None" for the DICOM assetstore limit ([#1359](../../pull/1359)) -- Fix series detection for some bioformats files ([#1365](../../pull/1365)) +- Fix series detection for some bioformats files ([#1365](../../pull/1365), [#1367](../../pull/1367)) ## 1.26.0 diff --git a/sources/bioformats/large_image_source_bioformats/__init__.py b/sources/bioformats/large_image_source_bioformats/__init__.py index 9e790fe51..cc8ed7237 100644 --- a/sources/bioformats/large_image_source_bioformats/__init__.py +++ b/sources/bioformats/large_image_source_bioformats/__init__.py @@ -352,17 +352,20 @@ def _getSeriesStarts(self, rdr): # noqa for idx in range(1, self._metadata['seriesCount']): rdr.setSeries(idx) if (rdr.getSizeX() == self._metadata['sizeX'] and - rdr.getSizeY() == self._metadata['sizeY']): + rdr.getSizeY() == self._metadata['sizeY'] and + rdr.getImageCount() == self._metadata['imageCount']): frameList.append([idx]) if nextSeriesNum == idx: nextSeriesNum = idx + 1 lastX, lastY = self._metadata['sizeX'], self._metadata['sizeY'] - if (rdr.getSizeX() * rdr.getSizeY() > - self._metadata['sizeX'] * self._metadata['sizeY']): + if (rdr.getSizeX() * rdr.getSizeY() * rdr.getImageCount() > + self._metadata['sizeX'] * self._metadata['sizeY'] * + self._metadata['imageCount']): frameList = [[idx]] nextSeriesNum = idx + 1 self._metadata['sizeX'] = self.sizeX = lastX = rdr.getSizeX() self._metadata['sizeY'] = self.sizeY = lastY = rdr.getSizeY() + self._metadata['imageCount'] = rdr.getImageCount() if (lastX and lastY and nearPowerOfTwo(rdr.getSizeX(), lastX) and rdr.getSizeX() < lastX and nearPowerOfTwo(rdr.getSizeY(), lastY) and rdr.getSizeY() < lastY):