Skip to content

Commit

Permalink
Address CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiamarcolini authored and ernestoarbitrio committed Sep 9, 2020
1 parent 3ba53b3 commit 86732e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/histolab/scorer.py
Expand Up @@ -64,7 +64,6 @@ def __call__(self, tile: Tile) -> float:
float
Nuclei score
"""
tissue_ratio = tile.tissue_ratio

filters_raw_nuclei = imf.Compose(
[imf.HematoxylinChannel(), imf.YenThreshold(operator.gt)]
Expand All @@ -79,4 +78,4 @@ def __call__(self, tile: Tile) -> float:
mask_nuclei = mask_difference(mask_raw_nuclei, mask_nuclei_clean)
nuclei_ratio = np.count_nonzero(mask_nuclei) / mask_nuclei.size

return nuclei_ratio * np.tanh(tissue_ratio)
return nuclei_ratio * np.tanh(tile.tissue_ratio)
7 changes: 4 additions & 3 deletions src/histolab/tiler.py
Expand Up @@ -599,14 +599,15 @@ def _highest_score_tiles(self, slide: Slide) -> List[Tuple[float, CoordinatePair
sorted_tiles_by_scaled_score = sorted(
scaled_scores, key=lambda x: x[0], reverse=True
)
if self.n_tiles < 0:
raise ValueError(f"'n_tiles' cannot be negative ({self.n_tiles})")

if self.n_tiles > 0:
highest_score_tiles = sorted_tiles_by_score[: self.n_tiles]
highest_scaled_score_tiles = sorted_tiles_by_scaled_score[: self.n_tiles]
elif self.n_tiles == 0:
else:
highest_score_tiles = sorted_tiles_by_score
highest_scaled_score_tiles = sorted_tiles_by_scaled_score
else:
raise ValueError(f"'n_tiles' cannot be negative ({self.n_tiles})")

return highest_score_tiles, highest_scaled_score_tiles

Expand Down

0 comments on commit 86732e3

Please sign in to comment.