Skip to content

Commit

Permalink
coalesce all utils in wsi/utils.py; less exposed methods; more docstr…
Browse files Browse the repository at this point in the history
…ings
  • Loading branch information
afrendeiro committed Mar 15, 2024
1 parent 36403f2 commit 176877a
Show file tree
Hide file tree
Showing 8 changed files with 433 additions and 660 deletions.
311 changes: 161 additions & 150 deletions wsi/WholeSlideImage.py

Large diffs are not rendered by default.

90 changes: 0 additions & 90 deletions wsi/dataset_h5.py

This file was deleted.

44 changes: 0 additions & 44 deletions wsi/file_utils.py

This file was deleted.

27 changes: 23 additions & 4 deletions wsi/tests/test_wsi.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
from pathlib import Path
import tempfile
import joblib

import requests
import pytest
from wsi import WholeSlideImage
import numpy as np


@pytest.mark.wsi
@pytest.mark.slow
def test_whole_slide_image_inference():
mem = joblib.Memory("cache", verbose=0)


@pytest.fixture(scope="session")
@mem.cache
def get_test_slide():
slide_file = "GTEX-O5YU-1426"
url = f"https://brd.nci.nih.gov/brd/imagedownload/{slide_file}"
slide = WholeSlideImage(url)
path = Path(tempfile.NamedTemporaryFile().name)

with open(path, "wb") as file:
for chunk in requests.get(url, stream=True).iter_content(chunk_size=1024):
file.write(chunk)
return path


@pytest.mark.wsi
@pytest.mark.slow
def test_whole_slide_image_inference(get_test_slide):
slide = WholeSlideImage(get_test_slide)
slide.segment()
slide.tile()
feats, coords = slide.inference("resnet18")
Expand Down
98 changes: 0 additions & 98 deletions wsi/util_classes.py

This file was deleted.

Loading

0 comments on commit 176877a

Please sign in to comment.