Skip to content

Commit

Permalink
Merge pull request #1376 from girder/tifffile-mag-values
Browse files Browse the repository at this point in the history
Guard against bad tifffile magnification values
  • Loading branch information
manthey authored Nov 16, 2023
2 parents 329226e + 6ac14e2 commit a95f81e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Fix series detection for some bioformats files ([#1365](../../pull/1365), [#1367](../../pull/1367))
- Fix time comparison in annotation history check ([#1369](../../pull/1369))
- Fix an issue with apply a frame style to ome tiffs ([#1374](../../pull/1374))
- Guard against bad tifffile magnification values ([#1376](../../pull/1376))

## 1.26.0

Expand Down
6 changes: 4 additions & 2 deletions sources/tifffile/large_image_source_tifffile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ def __init__(self, path, **kwargs): # noqa
try:
unit = {2: 25.4, 3: 10}[page.tags['ResolutionUnit'].value.real]

if page.tags['XResolution'].value[1] >= 100:
if (page.tags['XResolution'].value[0] and (
page.tags['XResolution'].value[1] / page.tags['XResolution'].value[0]) >= 100):
self._mm_x = (unit * page.tags['XResolution'].value[1] /
page.tags['XResolution'].value[0])
if page.tags['YResolution'].value[1] >= 100:
if (page.tags['YResolution'].value[0] and (
page.tags['YResolution'].value[1] / page.tags['YResolution'].value[0]) >= 100):
self._mm_y = (unit * page.tags['YResolution'].value[1] /
page.tags['YResolution'].value[0])
except Exception:
Expand Down

0 comments on commit a95f81e

Please sign in to comment.