Skip to content

Commit

Permalink
Merge pull request #608 from girder/nd2-missing-metadata
Browse files Browse the repository at this point in the history
Handle some nd2 files with missing metadata.
  • Loading branch information
manthey authored May 20, 2021
2 parents 1f30fc5 + 01b6e38 commit dbadfb7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions sources/nd2/large_image_source_nd2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit dbadfb7

Please sign in to comment.