def test_read_patches_str(self, input_parameters, expected):
     dataset = PatchWSIDataset(reader=self.backend, **input_parameters)
     sample = dataset[0]
     self.assertTupleEqual(sample["label"].shape,
                           expected["label"].shape)
     self.assertTupleEqual(sample["image"].shape,
                           expected["image"].shape)
     self.assertIsNone(
         assert_array_equal(sample["label"], expected["label"]))
     self.assertIsNone(
         assert_array_equal(sample["image"], expected["image"]))
 def test_read_patches_str_multi(self, input_parameters, expected):
     dataset = PatchWSIDataset(reader=self.backend, **input_parameters)
     for i in range(len(dataset)):
         self.assertTupleEqual(dataset[i]["label"].shape,
                               expected[i]["label"].shape)
         self.assertTupleEqual(dataset[i]["image"].shape,
                               expected[i]["image"].shape)
         self.assertIsNone(
             assert_array_equal(dataset[i]["label"],
                                expected[i]["label"]))
         self.assertIsNone(
             assert_array_equal(dataset[i]["image"],
                                expected[i]["image"]))
 def test_read_patches_class(self, input_parameters, expected):
     if self.backend == "openslide":
         reader = OpenSlideWSIReader
     elif self.backend == "cucim":
         reader = CuCIMWSIReader
     else:
         raise ValueError("Unsupported backend: {self.backend}")
     dataset = PatchWSIDataset(reader=reader, **input_parameters)
     sample = dataset[0]
     self.assertTupleEqual(sample["label"].shape,
                           expected["label"].shape)
     self.assertTupleEqual(sample["image"].shape,
                           expected["image"].shape)
     self.assertIsNone(
         assert_array_equal(sample["label"], expected["label"]))
     self.assertIsNone(
         assert_array_equal(sample["image"], expected["image"]))