Skip to content

Commit

Permalink
fix negative levels
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole Bussola committed Jan 11, 2021
1 parent 01d1841 commit 2d812dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/histolab/slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def extract_tile(self, coords: CoordinatePair, level: int) -> Tile:
Image containing the selected tile.
"""

level = level if level >= 0 else self._remap_level(level)
if not self._has_valid_coords(coords):
# OpenSlide doesn't complain if the coordinates for extraction are wrong,
# but it returns an odd image.
Expand Down
9 changes: 8 additions & 1 deletion tests/integration/test_tiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ class DescribeScoreTiler:
False,
"tiles-location-images/cmu-1-small-region-tl-scored-false",
),
(
SVS.TCGA_CR_7395_01A_01_TS1,
-2,
False,
True,
"tiles-location-images/tcga-cr-7395-01a-01-ts1-tl-scored-false",
),
(
SVS.TCGA_CR_7395_01A_01_TS1,
0,
Expand Down Expand Up @@ -166,7 +173,7 @@ class DescribeScoreTiler:
),
],
)
def it_locates_tiles_on_the_slide(
def it_locates_tiles_on_the_slide22(
self,
request,
fixture_slide,
Expand Down

0 comments on commit 2d812dd

Please sign in to comment.