Skip to content

Commit

Permalink
support inch
Browse files Browse the repository at this point in the history
  • Loading branch information
martvanrijthoven authored Jun 24, 2024
1 parent 348140a commit 2c50b67
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wholeslidedata/interoperability/openslide/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ def _init_spacings(self, downsamplings) -> List[float]:
spacing = float(self.properties["openslide.mpp-x"])
except KeyError as key_error:
try:
unit = {"cm": 10000, "centimeter": 10000}[
self.properties["tiff.ResolutionUnit"]
]
unit = {
"cm": 10000,
"centimeter": 10000,
"inch": 25400,
"inches": 25400 # 1 inch = 25400 micrometers
}[self.properties["tiff.ResolutionUnit"]]
res = float(self.properties["tiff.XResolution"])
spacing = unit / res
except KeyError as key_error:
Expand Down

0 comments on commit 2c50b67

Please sign in to comment.