Skip to content

Commit

Permalink
Fix pyramid level rounding error
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogabrielsson committed Sep 6, 2024
1 parent f2c7232 commit 96b1cc1
Show file tree
Hide file tree
Showing 5 changed files with 293 additions and 247 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] -

## [0.13.2] - 2024-09-06

### Fixed

- Rounding error when calculating level pyramid index if downsampled image size was rounded up.

## [0.13.1] - 2024-07-01

### Fixed
Expand Down Expand Up @@ -213,7 +219,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release of opentile.

[Unreleased]: https://github.com/imi-bigpicture/opentile/compare/v0.13.1..HEAD
[Unreleased]: https://github.com/imi-bigpicture/opentile/compare/v0.13.2..HEAD
[0.13.2]: https://github.com/imi-bigpicture/opentile/compare/v0.13.1..v0.13.2
[0.13.1]: https://github.com/imi-bigpicture/opentile/compare/v0.13.0..v0.13.1
[0.13.0]: https://github.com/imi-bigpicture/opentile/compare/v0.12.0..v0.13.0
[0.12.0]: https://github.com/imi-bigpicture/opentile/compare/v0.11.2..v0.12.0
Expand Down
2 changes: 1 addition & 1 deletion opentile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
from opentile.opentile import OpenTile
from opentile.metadata import Metadata

__version__ = "0.13.1"
__version__ = "0.13.2"
2 changes: 1 addition & 1 deletion opentile/tiff_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def _calculate_pyramidal_index(
self,
base_size: Size,
) -> int:
return int(math.log2(base_size.width / self.image_size.width))
return round(math.log2(base_size.width / self.image_size.width))

def _calculate_mpp(self, base_mpp: SizeMm) -> SizeMm:
return base_mpp * pow(2, self.pyramid_index)
Expand Down
Loading

0 comments on commit 96b1cc1

Please sign in to comment.