From 40a1036e42d329a658b1cc7b8c8d1727aacbd82b Mon Sep 17 00:00:00 2001 From: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com> Date: Fri, 31 Mar 2023 10:03:27 +0100 Subject: [PATCH 1/6] :wrench: Use `pyproject.toml` for `bdist_wheel` configuration (#575) - Use `pyproject.toml` for `bdist_wheel` configuration - Remove `aliases` Co-authored-by: John Pocock --- pyproject.toml | 7 +++++++ setup.cfg | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c6924538e..669feba45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,3 +34,10 @@ ] ignore_errors = true omit = ['tests/*', 'tiatoolbox/__main__.py', '*/utils/env_detection.py'] + +[build-system] + requires = ["setuptools"] + build-backend = "setuptools.build_meta" + +[tool.distutils.bdist_wheel] + universal = true diff --git a/setup.cfg b/setup.cfg index 638c5f2ec..b459f3c7d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,9 +19,6 @@ replace = version: {new_version} # TIAToolbox version search = TOOLBOX_VER: {current_version} replace = TOOLBOX_VER: {new_version} -[bdist_wheel] -universal = 1 - [flake8] exclude = docs, *__init__*, setup.py max-line-length = 88 @@ -31,9 +28,6 @@ dictionaries = en_US,python,technical max-cognitive-complexity = 14 max-expression-complexity = 7 -[aliases] -test = pytest - [tool:pytest] collect_ignore = ['setup.py', 'benchmark/'] From eb979f33cec338ec6dc1772d18ac683763154c86 Mon Sep 17 00:00:00 2001 From: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com> Date: Fri, 31 Mar 2023 10:58:17 +0100 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=94=A7=20Use=20pyproject.toml=20for?= =?UTF-8?q?=20pytest=20Configuration=20(#573)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use pyproject.toml for pytest Configuration Co-authored-by: John Pocock --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 669feba45..5ac7a6e59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +[tool.pytest.ini_options] +collect_ignore = ["setup.py", "benchmark/"] + [tool.black] exclude = ''' /( From 1529a04eba08049be864f7ed24306223ea8ba3a4 Mon Sep 17 00:00:00 2001 From: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com> Date: Fri, 31 Mar 2023 11:50:16 +0100 Subject: [PATCH 3/6] :wrench: Use `pyproject.toml` for `isort` Configuration (#572) * :wrench: Use pyproject.toml for isort configuration - Use pyproject.toml for isort configuration --------- Co-authored-by: John Pocock Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- pyproject.toml | 7 +++++++ setup.cfg | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5ac7a6e59..e52c81ac5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,13 @@ collect_ignore = ["setup.py", "benchmark/"] ignore_errors = true omit = ['tests/*', 'tiatoolbox/__main__.py', '*/utils/env_detection.py'] +[tool.isort] + profile = "black" + multi_line_output = 3 + line_length = 88 + filter_files = "True" + skip = [".gitignore", "benchmarks/*"] + [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index b459f3c7d..c91a40a63 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,10 +30,3 @@ max-expression-complexity = 7 [tool:pytest] collect_ignore = ['setup.py', 'benchmark/'] - -[isort] -profile = black -multi_line_output = 3 -skip_gitignore = True -line_length = 88 -filter_files = True From 8b18a4465e5e5a9f0654825065e672debb641b2d Mon Sep 17 00:00:00 2001 From: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:08:07 +0100 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=94=A7=20Use=20`pyproject.toml`=20for?= =?UTF-8?q?=20`pytest`=20Configuration=20(#579)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use `pyproject.toml` for `pytest` Configuration --- pyproject.toml | 2 +- setup.cfg | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e52c81ac5..f6028b2d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.pytest.ini_options] -collect_ignore = ["setup.py", "benchmark/"] + collect_ignore = ["setup.py", "benchmark/"] [tool.black] exclude = ''' diff --git a/setup.cfg b/setup.cfg index c91a40a63..3aa3fc992 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,6 +27,3 @@ spellcheck-targets = comments dictionaries = en_US,python,technical max-cognitive-complexity = 14 max-expression-complexity = 7 - -[tool:pytest] -collect_ignore = ['setup.py', 'benchmark/'] From 41b3c66157b77b4cdbd296dc8b39ae9c64afb82a Mon Sep 17 00:00:00 2001 From: John Pocock Date: Fri, 31 Mar 2023 14:10:52 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=E2=9C=A8=20Return=20True=20for=20`is=5Fngf?= =?UTF-8?q?f`=20With=20Warning=20Above=20Max=20NGFF=20Version=20(#577)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR Changes `is_ngff` to return True when above the max supported version with a warning logged. Co-authored-by: Shan Raza <13048456+shaneahmed@users.noreply.github.com> --- tests/test_wsireader.py | 12 ++++++++---- tiatoolbox/wsicore/wsireader.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/test_wsireader.py b/tests/test_wsireader.py index 1d89baa24..59afacb2a 100644 --- a/tests/test_wsireader.py +++ b/tests/test_wsireader.py @@ -2118,7 +2118,7 @@ def test_ngff_omero_below_min_version(tmp_path): wsireader.WSIReader.open(sample_copy) -def test_ngff_omero_above_max_version(tmp_path): +def test_ngff_omero_above_max_version(tmp_path, caplog): """Test for FileNotSupported when omero version is above maximum.""" sample = _fetch_remote_sample("ngff-1") # Create a copy of the sample @@ -2130,8 +2130,10 @@ def test_ngff_omero_above_max_version(tmp_path): zattrs["omero"]["version"] = "10.0" with open(sample_copy / ".zattrs", "w") as fh: json.dump(zattrs, fh, indent=2) - with pytest.raises(FileNotSupported): + # Check that the warning is logged + with caplog.at_level(logging.WARNING): wsireader.WSIReader.open(sample_copy) + assert "maximum supported version" in caplog.text def test_ngff_multiscales_below_min_version(tmp_path): @@ -2150,7 +2152,7 @@ def test_ngff_multiscales_below_min_version(tmp_path): wsireader.WSIReader.open(sample_copy) -def test_ngff_multiscales_above_max_version(tmp_path): +def test_ngff_multiscales_above_max_version(tmp_path, caplog): """Test for FileNotSupported when multiscales version is above maximum.""" sample = _fetch_remote_sample("ngff-1") # Create a copy of the sample @@ -2162,8 +2164,10 @@ def test_ngff_multiscales_above_max_version(tmp_path): zattrs["multiscales"][0]["version"] = "10.0" with open(sample_copy / ".zattrs", "w") as fh: json.dump(zattrs, fh, indent=2) - with pytest.raises(FileNotSupported): + # Check that the warning is logged + with caplog.at_level(logging.WARNING): wsireader.WSIReader.open(sample_copy) + assert "maximum supported version" in caplog.text def test_ngff_non_numeric_version(tmp_path, monkeypatch): diff --git a/tiatoolbox/wsicore/wsireader.py b/tiatoolbox/wsicore/wsireader.py index f2ecf3920..fc1a2e527 100644 --- a/tiatoolbox/wsicore/wsireader.py +++ b/tiatoolbox/wsicore/wsireader.py @@ -165,7 +165,7 @@ def is_ngff( max_version, multiscales_versions, ) - return False + return True if len(multiscales_versions) > 1: logger.warning( @@ -189,7 +189,7 @@ def is_ngff( max_version, multiscales_versions, ) - return False + return True return is_zarr(path) From 2f496aa581badb3933c4e261747a7292c6504a49 Mon Sep 17 00:00:00 2001 From: measty <20169086+measty@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:00:33 +0100 Subject: [PATCH 6/6] fix for recent dicom update --- tiatoolbox/wsicore/wsireader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiatoolbox/wsicore/wsireader.py b/tiatoolbox/wsicore/wsireader.py index 639272dfc..025f4b21b 100644 --- a/tiatoolbox/wsicore/wsireader.py +++ b/tiatoolbox/wsicore/wsireader.py @@ -3831,7 +3831,7 @@ def _info(self) -> WSIMeta: ) for level in self.wsi.levels ] - dataset = self.wsi.base_level.datasets[0] + dataset = self.wsi.levels.base_level.datasets[0] # Get pixel spacing in mm from DICOM file and convert to um/px (mpp) mm_per_pixel = dataset.pixel_spacing mpp = (mm_per_pixel.width * 1e3, mm_per_pixel.height * 1e3)