Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tile.has_enough_tissue sometimes returns False on tiles with tissue only #357

@lorenz-gorini

Description

@lorenz-gorini

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)
False

When inspecting we found that tile._has_tissue_more_than_percent(tissue_percent=80) 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)

Screenshots
tile_1_issue
tile_1_issue_mask
tile_2_issue
tile_2_issue_mask

Software (please complete the following information):

  • OS: Ubuntu 20.04
  • Python Version: 3.8
  • histolab version: 0.2.5

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions