Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against bad tifffile magnification values #1383

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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