Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole Bussola authored and ernestoarbitrio committed Jan 18, 2021
1 parent b8343d7 commit e481035
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,17 @@ random_tiles_extractor = RandomTiler(
Notice that we also specify the random seed to ensure the
reproducibility of the extraction process.

We may want to check which tiles have been selected by the tiler, before starting the extraction procedure and save them;
We may want to check which tiles have been selected by the tiler, before starting the extraction procedure and saving them;
the ``locate_tiles`` method of ``RandomTiler`` returns a scaled version of the slide with the corresponding tiles outlined. It is also possible to specify
the transparency of the background slide, and the color used for the border of each tile:

```python
random_tiles_extractor.locate_tiles(
slide=prostate_slide,
scale_factor=24, # default
alpha=128, # default
outline="red", # default
)
random_tiles_extractor.locate_tiles(
slide=prostate_slide,
scale_factor=24, # default
alpha=128, # default
outline="red", # default
)
```

![](https://user-images.githubusercontent.com/31658006/104055082-6bf1b100-51ee-11eb-8353-1f5958d521d8.png)
Expand Down Expand Up @@ -334,11 +334,11 @@ Again, we can exploit the ``locate_tiles`` method to visualize the selected tile

```python
grid_tiles_extractor.locate_tiles(
slide=ovarian_slide,
scale_factor=64,
alpha=64,
outline="#046C4C",
)
slide=ovarian_slide,
scale_factor=64,
alpha=64,
outline="#046C4C",
)
```

![](https://user-images.githubusercontent.com/31658006/104107093-37e3c200-52ba-11eb-8750-67a62bf62ca5.png)
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ extractor as follows:
Notice that we also specify the random seed to ensure the reproducibility of
the extraction process.

We may want to check which tiles have been selected by the tiler, before starting the extraction procedure and save them;
We may want to check which tiles have been selected by the tiler, before starting the extraction procedure and saving them;
the ``locate_tiles`` method of ``RandomTiler`` returns a scaled version of the slide with the corresponding tiles outlined. It is also possible to specify
the transparency of the background slide, and the color used for the border of the tiles:

Expand Down
5 changes: 2 additions & 3 deletions src/histolab/tiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def locate_tiles(
img.putalpha(alpha)
draw = PIL.ImageDraw.Draw(img)

tiles = list(self._tiles_locator(slide))
tiles = self._tiles_locator(slide)
tiles_coords = (tile[1] for tile in tiles)
for coords in tiles_coords:
rescaled = scale_coordinates(coords, slide.dimensions, img.size)
Expand Down Expand Up @@ -683,8 +683,6 @@ def extract(self, slide: Slide, report_path: str = None):
)

highest_score_tiles = self._highest_score_tiles(slide)
highest_scaled_score_tiles = self._highest_score_tiles(slide, scaled=True)

tiles_counter = 0
filenames = []

Expand All @@ -696,6 +694,7 @@ def extract(self, slide: Slide, report_path: str = None):
print(f"\t Tile {tiles_counter} - score: {score} saved: {tile_filename}")

if report_path:
highest_scaled_score_tiles = self._highest_score_tiles(slide, scaled=True)
self._save_report(
report_path, highest_score_tiles, highest_scaled_score_tiles, filenames
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_tiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ def it_can_extract_score_tiles(self, request, tmpdir):
call(slide, coords, 0),
call(slide, coords, 0),
]
_highest_score_tiles.assert_called_with(score_tiler, slide, True)
_highest_score_tiles.assert_called_with(score_tiler, slide)
assert _tile_filename.call_args_list == [
call(score_tiler, coords, 0),
call(score_tiler, coords, 1),
Expand Down

0 comments on commit e481035

Please sign in to comment.