Skip to content

Commit

Permalink
Merge pull request #569 from girder/harden-bioformats
Browse files Browse the repository at this point in the history
Harden bioformats reader for certain images.
  • Loading branch information
manthey authored Mar 15, 2021
2 parents 3bd814a + a53e465 commit fe23c17
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sources/bioformats/large_image_source_bioformats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,15 @@ def _getSeriesStarts(self, rdr):
self._logger.debug('Failed to parse series information: %s', exc)
rdr.setSeries(0)
return 1
if not len(seriesMetadata):
frameList = [[0]]
nextSeriesNum = 1
for idx in range(1, self._metadata['seriesCount']):
rdr.setSeries(idx)
if rdr.getSizeX() == self.sizeX and rdr.getSizeY == self.sizeY:
frameList.append([idx])
if nextSeriesNum == idx:
nextSeriesNum = idx + 1
frameList = [fl for fl in frameList if len(fl)]
self._metadata['frameSeries'] = [{
'series': fl,
Expand All @@ -303,6 +312,8 @@ def _checkSeries(self, rdr):
firstPossibleAssoc = self._getSeriesStarts(rdr)
self._metadata['seriesAssociatedImages'] = {}
for seriesNum in range(firstPossibleAssoc, self._metadata['seriesCount']):
if any((seriesNum in series['series']) for series in self._metadata['frameSeries']):
continue
rdr.setSeries(seriesNum)
info = {
'sizeX': rdr.getSizeX(),
Expand Down

0 comments on commit fe23c17

Please sign in to comment.