Ejemplo n.º 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, "")
        grid_tiles_extractor = GridTiler(
            tile_size=tile_size,
            level=level,
            check_tissue=check_tissue,
        )
        expected_img = load_expectation(expectation, type_="png")

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

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

        np.testing.assert_array_almost_equal(tiles_location_img, expected_img)
Ejemplo n.º 2
0
    def it_locates_tiles_on_the_slide(self, request, fixture_slide,
                                      expectation, tmpdir):
        slide = Slide(fixture_slide, os.path.join(tmpdir, "processed"))
        grid_tiles_extractor = GridTiler(
            tile_size=(512, 512),
            level=0,
            check_tissue=False,
        )
        expected_img = load_expectation(expectation, type_="png")
        tiles_location_img = grid_tiles_extractor.locate_tiles(slide,
                                                               scale_factor=10)
        # --- Expanding test report with actual and expected images ---
        expand_tests_report(request,
                            expected=expected_img,
                            actual=tiles_location_img)

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