示例#1
0
    def it_locates_tiles_on_the_slide(
        self,
        request,
        fixture_slide,
        binary_mask,
        tile_size,
        level,
        check_tissue,
        expectation,
    ):
        slide = Slide(fixture_slide, "")
        random_tiles_extractor = RandomTiler(
            tile_size=tile_size,
            n_tiles=2,
            level=level,
            seed=42,
            check_tissue=check_tissue,
        )
        expected_img = load_expectation(
            expectation,
            type_="png",
        )

        tiles_location_img = random_tiles_extractor.locate_tiles(
            slide, binary_mask, scale_factor=10)

        # --- Expanding test report with actual and expected images ---
        expand_tests_report(request,
                            actual=tiles_location_img,
                            expected=expected_img)

        np.testing.assert_array_almost_equal(tiles_location_img, expected_img)
示例#2
0
    def it_locates_tiles_on_the_slide(self, request, fixture_slide,
                                      expectation, tmpdir):
        slide = Slide(fixture_slide, os.path.join(tmpdir, "processed"))
        slide.save_scaled_image(10)
        random_tiles_extractor = RandomTiler(tile_size=(512, 512),
                                             n_tiles=2,
                                             level=0,
                                             seed=42,
                                             check_tissue=False)
        expected_img = load_expectation(
            expectation,
            type_="png",
        )
        tiles_location_img = random_tiles_extractor.locate_tiles(
            slide, scale_factor=10)
        # --- Expanding test report with actual and expected images ---
        expand_tests_report(request,
                            actual=tiles_location_img,
                            expected=expected_img)

        np.testing.assert_array_almost_equal(np.asarray(tiles_location_img),
                                             expected_img)