Skip to content

Commit 1b810fd

Browse files
authored
Add SingleFileDataset for FOMO Inference (#209)
* . * Add Flake8 exceptions * Capital letters, man..
1 parent 6f01686 commit 1b810fd

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import torch
2+
3+
4+
class SingleFileTestDataset(torch.utils.data.Dataset):
5+
def __init__(self, raw_data_dir: str, pred_save_dir: str, suffix=".nii.gz", **kwargs): # noqa: U100
6+
self.data_path = raw_data_dir
7+
self.pred_save_dir = pred_save_dir
8+
self.suffix = suffix
9+
10+
def __len__(self):
11+
return 1
12+
13+
def __getitem__(self, idx): # noqa: U100
14+
# Here we generate the paths to the cases along with their ID which they will be saved as.
15+
# we pass "case" as a list of strings and case_id as a string to the dataloader which
16+
# will convert them to a list of tuples of strings and a tuple of a string.
17+
# i.e. ['path1', 'path2'] -> [('path1',), ('path2',)]
18+
19+
return {"data_paths": [self.data_path], "extension": self.suffix, "case_id": ""}

0 commit comments

Comments
 (0)