Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/setupapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
container:
image: nvcr.io/nvidia/pytorch:21.06-py3 # CUDA 11.3
options: --gpus all
runs-on: [self-hosted, linux, x64, common]
runs-on: [self-hosted, linux, x64, integration]
steps:
- uses: actions/checkout@v3
- name: cache weekly timestamp
Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- coverage>=5.5
- parameterized
- setuptools>=50.3.0,!=60.0.0
- ignite==0.4.8
- ignite==0.4.10
- gdown>=4.4.0
- scipy
- nibabel
Expand Down
2 changes: 1 addition & 1 deletion tests/min_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def run_testsuit():
exclude_cases = [ # these cases use external dependencies
"test_ahnet",
"test_arraydataset",
"test_auto3dseg_autorunner",
"test_auto3dseg_ensemble",
"test_auto3dseg_hpo",
"test_auto3dseg",
Expand Down Expand Up @@ -107,6 +106,7 @@ def run_testsuit():
"test_integration_workflows",
"test_integration_workflows_gan",
"test_integration_bundle_run",
"test_integration_autorunner",
"test_invert",
"test_invertd",
"test_iterable_dataset",
Expand Down
24 changes: 16 additions & 8 deletions tests/test_masked_inference_wsi_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# limitations under the License.

import os
import tempfile
import unittest
from unittest import skipUnless

Expand All @@ -30,23 +31,21 @@
FILE_NAME = f"temp_{base_name}"
FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", FILE_NAME + extension)

MASK1 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_tissue_mask1.npy")
MASK2 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_tissue_mask2.npy")
MASK4 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_tissue_mask4.npy")
MASK1, MASK2, MASK4 = "mask1.npy", "mask2.npy", "mask4.npy"

HEIGHT = 32914
WIDTH = 46000


def prepare_data():
def prepare_data(*masks):

mask = np.zeros((HEIGHT // 2, WIDTH // 2))
mask[100, 100] = 1
np.save(MASK1, mask)
np.save(masks[0], mask)
mask[100, 101] = 1
np.save(MASK2, mask)
np.save(masks[1], mask)
mask[100:102, 100:102] = 1
np.save(MASK4, mask)
np.save(masks[2], mask)


TEST_CASE_0 = [
Expand Down Expand Up @@ -156,24 +155,33 @@ def prepare_data():
]


@skip_if_quick
class TestMaskedInferenceWSIDataset(unittest.TestCase):
def setUp(self):
prepare_data()
self.base_dir = tempfile.TemporaryDirectory()
prepare_data(*[os.path.join(self.base_dir.name, m) for m in [MASK1, MASK2, MASK4]])
hash_type = testing_data_config("images", FILE_KEY, "hash_type")
hash_val = testing_data_config("images", FILE_KEY, "hash_val")
download_url_or_skip_test(FILE_URL, FILE_PATH, hash_type=hash_type, hash_val=hash_val)

def tearDown(self):
self.base_dir.cleanup()

@parameterized.expand([TEST_CASE_0, TEST_CASE_1, TEST_CASE_2, TEST_CASE_3, TEST_CASE_4])
@skipUnless(has_cim, "Requires CuCIM")
@skip_if_quick
def test_read_patches_cucim(self, input_parameters, expected):
for m in input_parameters["data"]:
m["mask"] = os.path.join(self.base_dir.name, m["mask"])
dataset = MaskedInferenceWSIDataset(**input_parameters)
self.compare_samples_expected(dataset, expected)

@parameterized.expand([TEST_CASE_OPENSLIDE_0, TEST_CASE_OPENSLIDE_1])
@skipUnless(has_osl, "Requires OpenSlide")
@skip_if_quick
def test_read_patches_openslide(self, input_parameters, expected):
for m in input_parameters["data"]:
m["mask"] = os.path.join(self.base_dir.name, m["mask"])
dataset = MaskedInferenceWSIDataset(**input_parameters)
self.compare_samples_expected(dataset, expected)

Expand Down