osbm commited on
Commit
7b444c6
·
1 Parent(s): 9af4e54

Update prostate158.py

Browse files
Files changed (1) hide show
  1. prostate158.py +75 -1
prostate158.py CHANGED
@@ -1,4 +1,78 @@
1
  import datasets
 
2
 
3
  import pandas as pd
4
- import numpy as np
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import datasets
2
+ from typing import List
3
 
4
  import pandas as pd
5
+ import numpy as np
6
+
7
+
8
+ _DESCRIPTION = "Prostate dataset."
9
+
10
+ class Prostate158Dataset(datasets.GeneratorBasedBuilder):
11
+ VERSION = datasets.Version("1.1.0")
12
+
13
+ BUILDER_CONFIGS = [
14
+ datasets.BuilderConfig(
15
+ name="first_domain",
16
+ version=VERSION,
17
+ description="This contains all of the dataset",
18
+ ),
19
+ ]
20
+
21
+ DEFAULT_CONFIG_NAME = "first_domain"
22
+
23
+ def _info(self):
24
+ # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
25
+
26
+ features = datasets.Features(
27
+ {
28
+ "t2": datasets.Array(),
29
+ "adc": datasets.Image(),
30
+ "dwi": datasets.Image(),
31
+ "mask": datasets.Image(),
32
+ }
33
+ )
34
+
35
+ return datasets.DatasetInfo(
36
+ description=_DESCRIPTION,
37
+ features=features,
38
+ )
39
+
40
+ def _split_generators(
41
+ self, dl_manager: datasets.DownloadManager
42
+ ) -> List[datasets.SplitGenerator]:
43
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
44
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
45
+
46
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
47
+ # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
48
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
49
+
50
+ downloaded_files = dl_manager.download(["data.zip"])
51
+
52
+ return [
53
+ datasets.SplitGenerator(
54
+ name=datasets.Split.TRAIN,
55
+ gen_kwargs={
56
+ "split": "train",
57
+ "downloaded_files": downloaded_files,
58
+ },
59
+ ),
60
+ datasets.SplitGenerator(
61
+ name=datasets.Split.VALID,
62
+ gen_kwargs={
63
+ "split": "valid",
64
+ "downloaded_files": downloaded_files,
65
+ },
66
+ ),
67
+ datasets.SplitGenerator(
68
+ name=datasets.Split.TEST,
69
+ gen_kwargs={
70
+ "split": "test",
71
+ "downloaded_files": downloaded_files,
72
+ },
73
+ ),
74
+ ]
75
+
76
+ def _generate_examples(self, split, downloaded_files):
77
+ print(split)
78
+ print(downloaded_files)