Skip to content

Commit

Permalink
Guard against bad tifffile magnification values
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Nov 21, 2023
1 parent 2712dcf commit a1f7846
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

### Improvements
- Fix the DICOM limit to say "Series" instead of "Studies" ([#1379](../../pull/1379))
- Add token authentication option for DICOMweb ([#1349](../../pull/1349))

### Bug Fixes
- Fix an issue applying ICC profile adjustments to multiple image modes ([#1382](../../pull/1382))
- Guard against bad tifffile magnification values ([#1383](../../pull/1383))

## 1.26.1

Expand Down
8 changes: 4 additions & 4 deletions sources/tifffile/large_image_source_tifffile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +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[0] and (
page.tags['XResolution'].value[1] / page.tags['XResolution'].value[0]) >= 100):
if (page.tags['XResolution'].value[0] and page.tags['XResolution'].value[1] and (
page.tags['XResolution'].value[0] / page.tags['XResolution'].value[1]) >= 100):
self._mm_x = (unit * page.tags['XResolution'].value[1] /
page.tags['XResolution'].value[0])
if (page.tags['YResolution'].value[0] and (
page.tags['YResolution'].value[1] / page.tags['YResolution'].value[0]) >= 100):
if (page.tags['YResolution'].value[0] and page.tags['YResolution'].value[1] and (
page.tags['YResolution'].value[0] / page.tags['YResolution'].value[1]) >= 100):
self._mm_y = (unit * page.tags['YResolution'].value[1] /
page.tags['YResolution'].value[0])
except Exception:
Expand Down

0 comments on commit a1f7846

Please sign in to comment.