From 4fbe8004b69cc9a80576a3b7419b22a86d3fe933 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 16 Jul 2024 19:28:44 +0800 Subject: [PATCH] Fix wsireader get mpp issue (#7921) Fixes #7918 ### Description The main issue is that enum is expressed differently between different pythons Related PR: https://github.com/Project-MONAI/MONAI/pull/7905 ### Types of changes - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- monai/data/wsi_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/data/wsi_reader.py b/monai/data/wsi_reader.py index 96d84d8cf1..2a4fe9f7a8 100644 --- a/monai/data/wsi_reader.py +++ b/monai/data/wsi_reader.py @@ -1097,7 +1097,7 @@ def get_mpp(self, wsi, level: int) -> tuple[float, float]: ): unit = wsi.pages[level].tags.get("ResolutionUnit") if unit is not None: - unit = str(unit.value)[8:] + unit = str(unit.value.name) if unit is None or len(unit) == 0: warnings.warn("The resolution unit is missing. `micrometer` will be used as default.") unit = "micrometer"