Skip to content

Commit

Permalink
fix wrong WholeSlideBag init
Browse files Browse the repository at this point in the history
  • Loading branch information
afrendeiro committed Jul 4, 2024
1 parent 262616e commit 9e3b866
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions wsi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import requests
import h5py
import numpy as np
import openslide
import cv2
import torch
from torch.utils.data import Dataset
Expand All @@ -16,7 +15,7 @@ class WholeSlideBag(Dataset):
def __init__(
self,
file_path,
wsi=None,
wsi,
pretrained=False,
custom_transforms=None,
custom_downsample=1,
Expand All @@ -26,6 +25,7 @@ def __init__(
"""
Args:
file_path (string): Path to the .h5 file containing patched data.
wsi (openslide object): OpenSlide object
pretrained (bool): Use ImageNet transforms
custom_transforms (callable, optional): Optional transform to be applied on a sample
custom_downsample (int): Custom defined downscale factor (overruled by target_patch_size)
Expand All @@ -34,8 +34,6 @@ def __init__(
self.target = target

self.pretrained = pretrained
if wsi is None:
wsi = openslide.open_slide(path)
self.wsi = wsi
if not custom_transforms:
self.roi_transforms = default_transforms(pretrained=pretrained)
Expand Down Expand Up @@ -221,8 +219,6 @@ def collate_features(batch, with_coords: bool = False):


def is_url(url: str | Path) -> bool:
import pathlib

if isinstance(url, Path):
url = url.as_posix()
return url.startswith("http")
Expand Down

0 comments on commit 9e3b866

Please sign in to comment.