Skip to content

Commit

Permalink
check that page0 is TiffPage inst (#188)
Browse files Browse the repository at this point in the history
* check that page0 is TiffPage inst

* require wsinfer-zoo 0.6.2 or higher

This fixes an issue where the directory $HOME/.wsinfer-zoo didn't exist
and that would throw an error.
  • Loading branch information
kaczmarj authored Sep 15, 2023
1 parent b05b7ee commit 123d7c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies = [
"torch>=1.7",
"torchvision",
"tqdm",
"wsinfer-zoo",
"wsinfer-zoo>=0.6.2",
]
dynamic = ["version"]

Expand Down
2 changes: 2 additions & 0 deletions wsinfer/wsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ def _get_mpp_tifffile(slide_path: str | Path) -> tuple[float, float]:
with tifffile.TiffFile(slide_path) as tif:
series0 = tif.series[0]
page0 = series0[0]
if not isinstance(page0, tifffile.TiffPage):
raise CannotReadSpacing("not a tifffile.TiffPage instance")
try:
resolution_unit = page0.tags["ResolutionUnit"].value
x_resolution = Fraction(*page0.tags["XResolution"].value)
Expand Down

0 comments on commit 123d7c1

Please sign in to comment.