Skip to content

Commit d5d0a0a

Browse files
authored
Add histopathology whole-slide image sample image (#848)
1 parent 051c927 commit d5d0a0a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

micro_sam/sample_data.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,29 @@ def fetch_nucleus_3d_example_data(save_directory: Union[str, os.PathLike]) -> st
381381
progressbar=True,
382382
)
383383
return os.path.join(save_directory, fname)
384+
385+
386+
def fetch_wholeslide_histopathology_example_data(save_directory: Union[str, os.PathLike]) -> str:
387+
"""Download the sample histpathology data for the 2d annotator.
388+
389+
This downloads a WSI image from https://openslide.cs.cmu.edu/download/openslide-testdata/,
390+
under the "CC0 1.0 Universal" license.
391+
392+
Args:
393+
save_directory: Root folder to save the downloaded data.
394+
395+
Returns:
396+
The path of the downloaded image.
397+
"""
398+
save_directory = Path(save_directory)
399+
os.makedirs(save_directory, exist_ok=True)
400+
print("Example data directory is:", save_directory.resolve())
401+
fname = "whole-slide-histopathology-example-image.svs"
402+
pooch.retrieve(
403+
url="https://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-1.svs",
404+
known_hash="00a3d54482cd707abf254fe69dccc8d06b8ff757a1663f1290c23418c480eb30",
405+
fname=fname,
406+
path=save_directory,
407+
progressbar=True,
408+
)
409+
return os.path.join(save_directory, fname)

0 commit comments

Comments
 (0)