Skip to content

Commit

Permalink
Merge pull request #660 from girder/guard-ometiff-exception
Browse files Browse the repository at this point in the history
Guard against an OME tiff exception.
  • Loading branch information
manthey authored Sep 23, 2021
2 parents 44f46e2 + cf1c961 commit fe1f69e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sources/ometiff/large_image_source_ometiff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ def _parseOMEInfo(self): # noqa
int(self._omebase['TiffData'][0].get('PlaneCount', 0)) == 1):
planes = copy.deepcopy(self._omebase.get(
'Plane', self._omebase.get('Channel')))
if isinstance(planes, dict):
planes = [planes]
self._omebase['SizeC'] = 1
for idx, plane in enumerate(planes):
plane['IndexC'] = idx
self._omebase['TiffData'] = planes
Expand All @@ -227,7 +230,7 @@ def _parseOMEInfo(self): # noqa
self._omebase.get('Plane', self._omebase['TiffData']))):
raise TileSourceError(
'OME Tiff contains frames that contain multiple planes')
except (KeyError, ValueError, IndexError):
except (KeyError, ValueError, IndexError, TypeError):
raise TileSourceError('OME Tiff does not contain an expected record')

def getMetadata(self):
Expand Down

0 comments on commit fe1f69e

Please sign in to comment.