Skip to content

Commit

Permalink
Add support for vips 8.10 (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn authored Aug 31, 2021
1 parent 2b37e85 commit ec53d75
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## 0.4.1 (2021-08-31)

* Added support for vips 8.10

## 0.4.0 (2021-08-09)

* Removed dependency on `gdcm`
Expand Down
2 changes: 1 addition & 1 deletion panimg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.4.0"
__version__ = "0.4.1"

import logging

Expand Down
13 changes: 10 additions & 3 deletions panimg/image_builders/tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,16 @@ def _convert_to_tiff(
str(path.absolute()), access="sequential"
)

# correct xres and yres if they have default value of 1
# can be removed once updated to VIPS 8.10
if image.get("xres") == 1 and "openslide.mpp-x" in image.get_fields():
using_old_vips = (
pyvips.base.version(0) == 8 and pyvips.base.version(1) < 10
)
if (
using_old_vips
and image.get("xres") == 1
and "openslide.mpp-x" in image.get_fields()
):
# correct xres and yres if they have default value of 1
# due to a bug that is resolved in pyvips 8.10
x_res = 1000.0 / float(image.get("openslide.mpp-x"))
y_res = 1000.0 / float(image.get("openslide.mpp-y"))
image = image.copy(xres=x_res, yres=y_res)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ commands =

[tool.poetry]
name = "panimg"
version = "0.4.0"
version = "0.4.1"
description = "Conversion of medical images to MHA and TIFF."
license = "Apache-2.0"
authors = ["James Meakin <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_panimg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == "0.4.0"
assert __version__ == "0.4.1"

0 comments on commit ec53d75

Please sign in to comment.