From c38248309e02bc5961ece290d0bfbd721b828ffd Mon Sep 17 00:00:00 2001 From: Behrooz <3968947+drbeh@users.noreply.github.com> Date: Thu, 19 Jan 2023 11:54:33 -0500 Subject: [PATCH 1/2] Fix redundant extension .tiff.tiff and basename Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com> --- tests/test_masked_inference_wsi_dataset.py | 5 ++--- tests/test_masked_patch_wsi_dataset.py | 3 +-- tests/test_patch_wsi_dataset.py | 3 +-- tests/test_sliding_patch_wsi_dataset.py | 3 +-- tests/test_smartcache_patch_wsi_dataset.py | 3 +-- tests/test_wsireader.py | 4 +--- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/test_masked_inference_wsi_dataset.py b/tests/test_masked_inference_wsi_dataset.py index e9cd6724ab..7c622768ec 100644 --- a/tests/test_masked_inference_wsi_dataset.py +++ b/tests/test_masked_inference_wsi_dataset.py @@ -29,9 +29,8 @@ FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") -base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" -FILE_NAME = f"temp_{base_name}" -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", FILE_NAME + extension) +FILE_NAME = f"temp_{FILE_KEY}.tiff" +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", FILE_NAME) MASK1, MASK2, MASK4 = "mask1.npy", "mask2.npy", "mask4.npy" diff --git a/tests/test_masked_patch_wsi_dataset.py b/tests/test_masked_patch_wsi_dataset.py index 730ce97bdb..a9a706bda7 100644 --- a/tests/test_masked_patch_wsi_dataset.py +++ b/tests/test_masked_patch_wsi_dataset.py @@ -34,8 +34,7 @@ FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") -base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", "temp_" + base_name + extension) +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") TEST_CASE_0 = [ {"data": [{"image": FILE_PATH, WSIPatchKeys.LEVEL: 8, WSIPatchKeys.SIZE: (2, 2)}], "mask_level": 8}, diff --git a/tests/test_patch_wsi_dataset.py b/tests/test_patch_wsi_dataset.py index d2cc139ebc..0f3307f7ce 100644 --- a/tests/test_patch_wsi_dataset.py +++ b/tests/test_patch_wsi_dataset.py @@ -35,8 +35,7 @@ FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") -base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", "temp_" + base_name + extension) +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") TEST_CASE_DEP_0 = [ { diff --git a/tests/test_sliding_patch_wsi_dataset.py b/tests/test_sliding_patch_wsi_dataset.py index e6d11de739..5980bdfa4c 100644 --- a/tests/test_sliding_patch_wsi_dataset.py +++ b/tests/test_sliding_patch_wsi_dataset.py @@ -34,8 +34,7 @@ FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") -base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", "temp_" + base_name + extension) +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") FILE_PATH_SMALL_0 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_wsi_inference_0.tiff") FILE_PATH_SMALL_1 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_wsi_inference_1.tiff") diff --git a/tests/test_smartcache_patch_wsi_dataset.py b/tests/test_smartcache_patch_wsi_dataset.py index e51033bb4e..277c59b9d4 100644 --- a/tests/test_smartcache_patch_wsi_dataset.py +++ b/tests/test_smartcache_patch_wsi_dataset.py @@ -28,8 +28,7 @@ FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") -base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", "temp_" + base_name + extension) +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") TEST_CASE_0 = [ { diff --git a/tests/test_wsireader.py b/tests/test_wsireader.py index 03af7a3f66..38b7e99acd 100644 --- a/tests/test_wsireader.py +++ b/tests/test_wsireader.py @@ -38,9 +38,7 @@ FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") -base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", "temp_" + base_name + extension) - +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") HEIGHT = 32914 WIDTH = 46000 From 317a58ea56dcd461e2ef6877e603a3c91b0b8b37 Mon Sep 17 00:00:00 2001 From: Behrooz <3968947+drbeh@users.noreply.github.com> Date: Fri, 20 Jan 2023 13:23:43 -0500 Subject: [PATCH 2/2] update to wsi_img.tiff Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com> --- tests/test_masked_inference_wsi_dataset.py | 4 ++-- tests/test_masked_patch_wsi_dataset.py | 4 ++-- tests/test_patch_wsi_dataset.py | 4 ++-- tests/test_sliding_patch_wsi_dataset.py | 4 ++-- tests/test_smartcache_patch_wsi_dataset.py | 4 ++-- tests/test_wsireader.py | 4 ++-- tests/testing_data/data_config.json | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_masked_inference_wsi_dataset.py b/tests/test_masked_inference_wsi_dataset.py index 7c622768ec..c330502ce2 100644 --- a/tests/test_masked_inference_wsi_dataset.py +++ b/tests/test_masked_inference_wsi_dataset.py @@ -27,9 +27,9 @@ _, has_cim = optional_import("cucim", name="CuImage") _, has_osl = optional_import("openslide") -FILE_KEY = "wsi_img" +FILE_KEY = "wsi_img.tiff" FILE_URL = testing_data_config("images", FILE_KEY, "url") -FILE_NAME = f"temp_{FILE_KEY}.tiff" +FILE_NAME = f"temp_{FILE_KEY}" FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", FILE_NAME) MASK1, MASK2, MASK4 = "mask1.npy", "mask2.npy", "mask4.npy" diff --git a/tests/test_masked_patch_wsi_dataset.py b/tests/test_masked_patch_wsi_dataset.py index a9a706bda7..b6cb006400 100644 --- a/tests/test_masked_patch_wsi_dataset.py +++ b/tests/test_masked_patch_wsi_dataset.py @@ -32,9 +32,9 @@ _, has_codec = optional_import("imagecodecs") has_tiff = has_tiff and has_codec -FILE_KEY = "wsi_img" +FILE_KEY = "wsi_img.tiff" FILE_URL = testing_data_config("images", FILE_KEY, "url") -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}") TEST_CASE_0 = [ {"data": [{"image": FILE_PATH, WSIPatchKeys.LEVEL: 8, WSIPatchKeys.SIZE: (2, 2)}], "mask_level": 8}, diff --git a/tests/test_patch_wsi_dataset.py b/tests/test_patch_wsi_dataset.py index 0f3307f7ce..6ad2fadf08 100644 --- a/tests/test_patch_wsi_dataset.py +++ b/tests/test_patch_wsi_dataset.py @@ -33,9 +33,9 @@ _, has_codec = optional_import("imagecodecs") has_tiff = has_tiff and has_codec -FILE_KEY = "wsi_img" +FILE_KEY = "wsi_img.tiff" FILE_URL = testing_data_config("images", FILE_KEY, "url") -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}") TEST_CASE_DEP_0 = [ { diff --git a/tests/test_sliding_patch_wsi_dataset.py b/tests/test_sliding_patch_wsi_dataset.py index 5980bdfa4c..c4e9c51381 100644 --- a/tests/test_sliding_patch_wsi_dataset.py +++ b/tests/test_sliding_patch_wsi_dataset.py @@ -32,9 +32,9 @@ _, has_codec = optional_import("imagecodecs") has_tiff = has_tiff and has_codec -FILE_KEY = "wsi_img" +FILE_KEY = "wsi_img.tiff" FILE_URL = testing_data_config("images", FILE_KEY, "url") -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}") FILE_PATH_SMALL_0 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_wsi_inference_0.tiff") FILE_PATH_SMALL_1 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_wsi_inference_1.tiff") diff --git a/tests/test_smartcache_patch_wsi_dataset.py b/tests/test_smartcache_patch_wsi_dataset.py index 277c59b9d4..5ae15cde5c 100644 --- a/tests/test_smartcache_patch_wsi_dataset.py +++ b/tests/test_smartcache_patch_wsi_dataset.py @@ -26,9 +26,9 @@ _cucim, has_cim = optional_import("cucim") has_cim = has_cim and hasattr(_cucim, "CuImage") -FILE_KEY = "wsi_img" +FILE_KEY = "wsi_img.tiff" FILE_URL = testing_data_config("images", FILE_KEY, "url") -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}") TEST_CASE_0 = [ { diff --git a/tests/test_wsireader.py b/tests/test_wsireader.py index 38b7e99acd..d606d41f05 100644 --- a/tests/test_wsireader.py +++ b/tests/test_wsireader.py @@ -36,9 +36,9 @@ _, has_codec = optional_import("imagecodecs") has_tiff = has_tiff and has_codec -FILE_KEY = "wsi_img" +FILE_KEY = "wsi_img.tiff" FILE_URL = testing_data_config("images", FILE_KEY, "url") -FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}.tiff") +FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", f"temp_{FILE_KEY}") HEIGHT = 32914 WIDTH = 46000 diff --git a/tests/testing_data/data_config.json b/tests/testing_data/data_config.json index 788d664439..1a91986fd8 100644 --- a/tests/testing_data/data_config.json +++ b/tests/testing_data/data_config.json @@ -1,6 +1,6 @@ { "images": { - "wsi_img": { + "wsi_img.tiff": { "url": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/CMU-1.tiff", "hash_type": "sha256", "hash_val": "73a7e89bc15576587c3d68e55d9bf92f09690280166240b48ff4b48230b13bcd"