Skip to content

Commit

Permalink
Merge pull request #320 from Dana-Farber-AIOS/informative-error-message
Browse files Browse the repository at this point in the history
Make error message for extract_region more informative
  • Loading branch information
jacob-rosenthal committed Jul 4, 2022
2 parents f635514 + eab3ceb commit 3e13d2b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pathml/core/slide_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ def extract_region(self, location, size, *args, **kwargs):
Returns:
np.ndarray: image at the specified region
"""
if self.slide is None:
raise ValueError(
"Cannot call `.extract_region()` because no slide is specified. "
"If already tiled, access `.tiles` directly instead"
)

return self.slide.extract_region(location, size, *args, **kwargs)

def generate_tiles(self, shape=3000, stride=None, pad=False, **kwargs):
Expand Down

0 comments on commit 3e13d2b

Please sign in to comment.