Skip to content

Commit

Permalink
tiffslide: fix downsamples compatibility
Browse files Browse the repository at this point in the history
This adjusts the level downsamples to be identical to openslide's.
Partially addresses #51.
  • Loading branch information
ap-- committed Jan 10, 2023
1 parent 2dd2c4b commit 7e95e37
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tiffslide/tiffslide.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ def level_dimensions(self) -> tuple[tuple[int, int], ...]:
def level_downsamples(self) -> tuple[float, ...]:
"""return the downsampling factors of levels as a list"""
w0, h0 = self.dimensions
return tuple(math.sqrt((w0 * h0) / (w * h)) for w, h in self.level_dimensions)
return tuple(
((w0 / w) + (h0 / h)) / 2.0
for w, h in self.level_dimensions
)

@cached_property
def properties(self) -> dict[str, Any]:
Expand Down

0 comments on commit 7e95e37

Please sign in to comment.