From 475054a286c5724747d6c3717c7a5870cebe4efa Mon Sep 17 00:00:00 2001 From: Wim Pomp Date: Thu, 10 Oct 2024 18:18:59 +0200 Subject: [PATCH] - support for tiled images - poetry --- bin/tiffexplore | 6 ------ pyproject.toml | 27 +++++++++++++++++++++++++++ setup.py | 23 ----------------------- tiffexplore/__init__.py | 2 +- tiffexplore/tiffread.py | 3 +++ 5 files changed, 31 insertions(+), 30 deletions(-) delete mode 100644 bin/tiffexplore create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/bin/tiffexplore b/bin/tiffexplore deleted file mode 100644 index ea6a50c..0000000 --- a/bin/tiffexplore +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -from tiffexplore import main - -if __name__ == '__main__': - main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6739535 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,27 @@ +[tool.poetry] +name = "tiffexplore" +version = "2024.10.0" +description = "Explore a tiff structure." +authors = ["Wim Pomp, "] +license = "GPL-3.0-or-later" +readme = "README.md" +packages = [{include = "tiffexplore"}] +repository = "https://github.com/wimpomp/tiffexplore" + +[tool.poetry.scripts] +tiffexplore = "tiffexplore:main" + +[tool.poetry.dependencies] +python = "^3.7" +tifffile = "*" +PyQt5 = "*" + +[tool.pytest.ini_options] +filterwarnings = ["ignore:::(?!tiffexplore)"] + +[tool.isort] +line_length = 119 + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/setup.py b/setup.py deleted file mode 100644 index c0fb08b..0000000 --- a/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - -setuptools.setup( - name="tiffexplore", - packages=["tiffexplore"], - version="2021.07.1", - author="Wim Pomp", - author_email="wimpomp@gmail.com", - description="Explore a tiff structure.", - long_description=long_description, - long_description_content_type="text/markdown", - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Operating System :: OS Independent", - ], - python_requires='>=3.7', - install_requires=['numpy', 'tifffile', 'PyQt5'], - scripts=['bin/tiffexplore'], -) diff --git a/tiffexplore/__init__.py b/tiffexplore/__init__.py index b24d01d..4d035c5 100644 --- a/tiffexplore/__init__.py +++ b/tiffexplore/__init__.py @@ -220,7 +220,7 @@ class App(QtWidgets.QMainWindow, UiMainWindow): shape = im.shape im = QtGui.QImage(im, im.shape[1], im.shape[0], QtGui.QImage.Format_Grayscale8) f = min([a / b for a, b in zip((self.image.height(), self.image.width()), shape)]) - pix = QtGui.QPixmap(im).scaled(f * shape[1], f * shape[0]) + pix = QtGui.QPixmap(im).scaled(int(f) * shape[1], int(f) * shape[0]) else: pix = QtGui.QPixmap() self.image.setPixmap(pix) diff --git a/tiffexplore/tiffread.py b/tiffexplore/tiffread.py index ac4b039..c9177d5 100644 --- a/tiffexplore/tiffread.py +++ b/tiffexplore/tiffread.py @@ -38,6 +38,9 @@ class tiff(): if 273 in tags and 279 in tags: for i, a in enumerate(zip(tags[273][-1], tags[279][-1])): self.addresses[('image', (*idx, i))] = a + elif 324 in tags and 325 in tags: + for i, a in enumerate(zip(tags[324][-1], tags[325][-1])): + self.addresses[('image', (*idx, i))] = a for code in (330, 400, 34665, 34853, 40965): if code in tags: if len(tags[code][3]) == 1: