Skip to content

Commit

Permalink
Raise errors to prompt data download
Browse files Browse the repository at this point in the history
  • Loading branch information
anwai98 committed Oct 21, 2023
1 parent 81d7e11 commit 51f5489
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions torch_em/data/datasets/neurips_cell_seg.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def to_rgb(image):
# (but we would need to know mapping of images to modality)
def _get_image_and_label_paths(root, split, val_fraction):
path = os.path.join(root, "TrainLabeled")
assert os.path.exists(root), root
assert os.path.exists(root), "Please download the dataset and assort the data as expected here.\
See `get_neurips_cellseg_supervised_dataset`"

image_folder = os.path.join(path, "images")
assert os.path.exists(image_folder)
Expand Down Expand Up @@ -101,7 +102,8 @@ def get_neurips_cellseg_supervised_dataset(
NOTE:
- The dataset isn't available to download using an in-built functionality
- Please download the dataset from here: https://drive.google.com/drive/folders/1NFplvkQzc_nHFwpnB55lw2nD6coc91VV
- Please download the dataset from here:\
https://drive.google.com/drive/folders/1NFplvkQzc_nHFwpnB55lw2nD6coc91VV
- REMEMBER: to convert the available data in the expected directory format
"""
assert split in ("train", "val", None), split
Expand Down Expand Up @@ -150,15 +152,17 @@ def get_neurips_cellseg_supervised_loader(

def _get_image_paths(root):
path = os.path.join(root, "TrainUnlabeled")
assert os.path.exists(path), path
assert os.path.exists(path), "Please download the dataset and assort the data as expected here.\
See `get_neurips_cellseg_unsupervised_dataset`"
image_paths = glob(os.path.join(path, "*"))
image_paths.sort()
return image_paths


def _get_wholeslide_paths(root, patch_shape):
path = os.path.join(root, "TrainUnlabeled_WholeSlide")
assert os.path.exists(path), path
assert os.path.exists(path), "Please download the dataset and assort the data as expected here.\
See `get_neurips_cellseg_unsupervised_dataset`"
image_paths = glob(os.path.join(path, "*"))
image_paths.sort()

Expand Down Expand Up @@ -192,7 +196,8 @@ def get_neurips_cellseg_unsupervised_dataset(
NOTE:
- The dataset isn't available to download using an in-built functionality
- Please download the dataset from here: https://drive.google.com/drive/folders/1NFplvkQzc_nHFwpnB55lw2nD6coc91VV
- Please download the dataset from here:\
https://drive.google.com/drive/folders/1NFplvkQzc_nHFwpnB55lw2nD6coc91VV
- REMEMBER: to convert the available data in the expected directory format
"""
if raw_transform is None:
Expand Down

0 comments on commit 51f5489

Please sign in to comment.