def it_knows_its_box_mask(self, request, tmpdir, check_tissue, expected_box): slide, _ = base_test_slide(tmpdir, PILIMG.RGBA_COLOR_500X500_155_249_240) _biggest_tissue_box_mask = property_mock(request, Slide, "biggest_tissue_box_mask") _biggest_tissue_box_mask.return_value = expected_box grid_tiler = GridTiler((128, 128), 0, check_tissue=check_tissue) box_mask = grid_tiler.box_mask(slide) _biggest_tissue_box_mask.assert_called_once_with() assert type(box_mask) == np.ndarray np.testing.assert_array_almost_equal(box_mask, expected_box)
def it_knows_its_box_mask(self, request, tmpdir, check_tissue, expected_box): tmp_path_ = tmpdir.mkdir("myslide") image = PILIMG.RGBA_COLOR_500X500_155_249_240 image.save(os.path.join(tmp_path_, "mywsi.png"), "PNG") slide_path = os.path.join(tmp_path_, "mywsi.png") slide = Slide(slide_path, "processed") _biggest_tissue_box_mask = property_mock( request, Slide, "biggest_tissue_box_mask" ) _biggest_tissue_box_mask.return_value = expected_box grid_tiler = GridTiler((128, 128), 0, check_tissue=check_tissue) box_mask = grid_tiler.box_mask(slide) _biggest_tissue_box_mask.assert_called_once_with() assert type(box_mask) == np.ndarray np.testing.assert_array_almost_equal(box_mask, expected_box)