-
-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Describe the bug
Tile.has_enough_tissue method sometimes returns False on tiles with tissue only.
Sometimes the filters used to extract the tissue mask of the tile are not identifying the whole tissue, but the cell nuclei only.
Therefore during tile extraction from the WSI, the tile will be wrongly discarded as if it contained too much background.
To Reproduce
Steps to reproduce the behavior (assuming that the attached .png files are saved in local path ~/Downloads):
>>> from histolab.tile import Tile
... from histolab.types import CoordinatePair
... tile = Tile("~/Downloads/tile_1_issue.png", CoordinatePair(3118, 2283, 3246, 2411))
... tile.has_enough_tissue(80, 0.1)
FalseWhen inspecting we found that returns
False.
To be more specific, we computed the tissue mask (that are used to check the tissue coverage) for some tiles by using the same code inside Tile._has_tissue_more_than_percent(80) method:
>>> from histolab.filters.compositions import FiltersComposition
... filters = FiltersComposition(Tile).tissue_mask_filters
... img = Image.fromarray(filters(tile._image))
... img.save("tile_1_issue_mask.png")and we found the attached masks tile_1_issue_mask.png and tile_2_issue_mask.png.
Expected behavior
We expected that the tissue masks of the tiles (tile_1_issue_mask.png and tile_2_issue_mask.png) were covering the whole tile, so that tile._has_tissue_more_than_percent(tissue_percent=80) would return True as well as tile.has_enough_tissue(80, 0.1)
Software (please complete the following information):
- OS: Ubuntu 20.04
- Python Version: 3.8
- histolab version: 0.2.5
Additional context