diff --git a/CHANGELOG.md b/CHANGELOG.md index 6447ed1ba..5c2f6be6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Allow specifying content disposition filenames in Girder RESET endpoints (#604) - Improve caching of unstyled tiles when compositing styled types (#605) - Speed up compositing some styled tiles (#606) +- Handle some nd2 files with missing metadata (#607) ## Version 1.6.0 diff --git a/sources/nd2/large_image_source_nd2/__init__.py b/sources/nd2/large_image_source_nd2/__init__.py index 0d74d7bae..5e05afc79 100644 --- a/sources/nd2/large_image_source_nd2/__init__.py +++ b/sources/nd2/large_image_source_nd2/__init__.py @@ -196,7 +196,7 @@ def _getND2Metadata(self): continue try: value = getattr(self._nd2.parser._raw_metadata, key, None) - except AttributeError: + except (AttributeError, TypeError): continue if isinstance(value, (types.GeneratorType, numpy.ndarray, array.array, range)): value = list(value) @@ -259,7 +259,7 @@ def getMetadata(self): frame['Index' + (axis.upper() if axis != 'v' else 'XY')] = ( idx // basis) % sizes[axis] basis *= sizes.get(axis, 1) - if 'z_coordinates' in self._metadata: + if self._metadata.get('z_coordinates'): frame['PositionZ'] = self._metadata['z_coordinates'][ref.get('z', 0)] frames.append(frame) if self._framecount and len(frames) == self._framecount: