ctkit 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ctkit/__init__.py +144 -0
- ctkit/api.py +358 -0
- ctkit/cli.py +754 -0
- ctkit/config.py +453 -0
- ctkit/constants.py +297 -0
- ctkit/dataset.py +1449 -0
- ctkit/datasets.py +216 -0
- ctkit/features.py +177 -0
- ctkit/image.py +1141 -0
- ctkit/io.py +384 -0
- ctkit/metadata.py +233 -0
- ctkit/py.typed +0 -0
- ctkit/qc.py +482 -0
- ctkit/segmentation.py +367 -0
- ctkit/tcia.py +427 -0
- ctkit/validation.py +187 -0
- ctkit-0.1.0.dist-info/METADATA +168 -0
- ctkit-0.1.0.dist-info/RECORD +22 -0
- ctkit-0.1.0.dist-info/WHEEL +5 -0
- ctkit-0.1.0.dist-info/entry_points.txt +2 -0
- ctkit-0.1.0.dist-info/licenses/LICENSE +24 -0
- ctkit-0.1.0.dist-info/top_level.txt +1 -0
ctkit/constants.py
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# verify links by visiting TCIA - manifest URL is what I get by clicking big blue "download" button for imaging data, and metadata url is what I get by clicking small "view" link under Metadata column
|
|
2
|
+
tcia_dataset_to_info = {
|
|
3
|
+
"tcga-kirc": {
|
|
4
|
+
"project": "tcga",
|
|
5
|
+
"cancer_organ": "kidney",
|
|
6
|
+
"cancer_type": "clear cell renal clear cell carcinoma",
|
|
7
|
+
"ONCOTREE_CODE": "KIDNEY",
|
|
8
|
+
"manifest_url": None, # None for default
|
|
9
|
+
"metadata_url": None, # None for default
|
|
10
|
+
"totalsegmentator_organs": ["kidney_left", "kidney_right"],
|
|
11
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
12
|
+
"xdim,ydim,zdim_masked": (185, 185, 75), # dimensions to standardize to when do_masking is True - set to (None, None, None) to use 95th percentile of extents across all series
|
|
13
|
+
"xdim,ydim,zdim_unmasked": (625, 625, 200) # dimensions to standardize to when do_masking is False - set to (None, None, None) to use 95th percentile of extents across all series
|
|
14
|
+
},
|
|
15
|
+
"tcga-lihc": {
|
|
16
|
+
"project": "tcga",
|
|
17
|
+
"cancer_organ": "liver",
|
|
18
|
+
"cancer_type": "hepatocellular carcinoma",
|
|
19
|
+
"ONCOTREE_CODE": "LIVER",
|
|
20
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/doiJNLP-TCGA-LIHC-01-30-2017.tcia", # None for default
|
|
21
|
+
"metadata_url": None, # None for default
|
|
22
|
+
"totalsegmentator_organs": ["liver"],
|
|
23
|
+
"clip_min,clip_max": (-200, 400), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
24
|
+
},
|
|
25
|
+
"tcga-blca": {
|
|
26
|
+
"project": "tcga",
|
|
27
|
+
"cancer_organ": "bladder",
|
|
28
|
+
"cancer_type": "urothelial carcinoma",
|
|
29
|
+
"ONCOTREE_CODE": "BLADDER",
|
|
30
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCGA-BLCA-August-30-2019-NBIA-manifest.tcia", # None for default
|
|
31
|
+
"metadata_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCGA-BLCA-August-30-2019-NBIA-manifes-nbia-digest.xlsx", # None for default
|
|
32
|
+
"totalsegmentator_organs": ["urinary_bladder"],
|
|
33
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
34
|
+
},
|
|
35
|
+
# "tcga-brca": {
|
|
36
|
+
# "project": "tcga",
|
|
37
|
+
# "cancer_organ": "breast",
|
|
38
|
+
# "cancer_type": "breast invasive carcinoma",
|
|
39
|
+
# "ONCOTREE_CODE": "BREAST",
|
|
40
|
+
# "manifest_url": None, # None for default
|
|
41
|
+
# "metadata_url": None, # None for default
|
|
42
|
+
# "totalsegmentator_organs": ["breasts"],
|
|
43
|
+
# "totalsegmentator_task": "breasts", # None/omit for total
|
|
44
|
+
# "clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
45
|
+
# },
|
|
46
|
+
# "tcga-cesc": {
|
|
47
|
+
# "project": "tcga",
|
|
48
|
+
# "cancer_organ": "cervix",
|
|
49
|
+
# "cancer_type": "cervical squamous cell carcinoma",
|
|
50
|
+
# "ONCOTREE_CODE": "CERVIX",
|
|
51
|
+
# "manifest_url": None, # None for default
|
|
52
|
+
# "metadata_url": None, # None for default
|
|
53
|
+
# "totalsegmentator_organs": [],
|
|
54
|
+
# "clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
55
|
+
# },
|
|
56
|
+
"tcga-coad": {
|
|
57
|
+
"project": "tcga",
|
|
58
|
+
"cancer_organ": "colon",
|
|
59
|
+
"cancer_type": "colon adenocarcinoma",
|
|
60
|
+
"ONCOTREE_CODE": "BOWEL",
|
|
61
|
+
"manifest_url": None, # None for default
|
|
62
|
+
"metadata_url": None, # None for default
|
|
63
|
+
"totalsegmentator_organs": ["colon"],
|
|
64
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
65
|
+
},
|
|
66
|
+
"tcga-esca": {
|
|
67
|
+
"project": "tcga",
|
|
68
|
+
"cancer_organ": "esophagus",
|
|
69
|
+
"cancer_type": "esophageal carcinoma",
|
|
70
|
+
"ONCOTREE_CODE": "ESOPHAGUS",
|
|
71
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA_TCGA-ESCA-09-16-2015.tcia", # None for default
|
|
72
|
+
"metadata_url": None, # None for default
|
|
73
|
+
"totalsegmentator_organs": ["esophagus"],
|
|
74
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
75
|
+
},
|
|
76
|
+
# "tcga-gbm": {
|
|
77
|
+
# "project": "tcga",
|
|
78
|
+
# "cancer_organ": "brain",
|
|
79
|
+
# "cancer_type": "glioblastoma multiforme",
|
|
80
|
+
# "ONCOTREE_CODE": "BRAIN",
|
|
81
|
+
# "manifest_url": None, # None for default
|
|
82
|
+
# "metadata_url": None, # None for default
|
|
83
|
+
# "totalsegmentator_organs": ["brain"],
|
|
84
|
+
# "clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
85
|
+
# },
|
|
86
|
+
# "tcga-hnsc": {
|
|
87
|
+
# "project": "tcga",
|
|
88
|
+
# "cancer_organ": "head_neck",
|
|
89
|
+
# "cancer_type": "head and neck squamous cell carcinoma",
|
|
90
|
+
# "ONCOTREE_CODE": "HEAD_NECK",
|
|
91
|
+
# "manifest_url": None, # None for default
|
|
92
|
+
# "metadata_url": None, # None for default
|
|
93
|
+
# "totalsegmentator_organs": ["skull"],
|
|
94
|
+
# "clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
95
|
+
# },
|
|
96
|
+
"tcga-kich": {
|
|
97
|
+
"project": "tcga",
|
|
98
|
+
"cancer_organ": "kidney",
|
|
99
|
+
"cancer_type": "chromophobe renal cell carcinoma",
|
|
100
|
+
"ONCOTREE_CODE": "KIDNEY",
|
|
101
|
+
"manifest_url": None, # None for default
|
|
102
|
+
"metadata_url": None, # None for default
|
|
103
|
+
"totalsegmentator_organs": ["kidney_left", "kidney_right"],
|
|
104
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
105
|
+
},
|
|
106
|
+
"tcga-kirp": {
|
|
107
|
+
"project": "tcga",
|
|
108
|
+
"cancer_organ": "kidney",
|
|
109
|
+
"cancer_type": "papillary renal cell carcinoma",
|
|
110
|
+
"ONCOTREE_CODE": "KIDNEY",
|
|
111
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/doiJNLP-TCGA-KIRP-01-30-2017.tcia", # None for default
|
|
112
|
+
"metadata_url": None, # None for default
|
|
113
|
+
"totalsegmentator_organs": ["kidney_left", "kidney_right"],
|
|
114
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
115
|
+
},
|
|
116
|
+
# "tcga-lgg": {
|
|
117
|
+
# "project": "tcga",
|
|
118
|
+
# "cancer_organ": "brain",
|
|
119
|
+
# "cancer_type": "lower grade glioma",
|
|
120
|
+
# "ONCOTREE_CODE": "BRAIN",
|
|
121
|
+
# "manifest_url": None, # None for default
|
|
122
|
+
# "metadata_url": None, # None for default
|
|
123
|
+
# "totalsegmentator_organs": ["brain"],
|
|
124
|
+
# "clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
125
|
+
# },
|
|
126
|
+
"tcga-luad": {
|
|
127
|
+
"project": "tcga",
|
|
128
|
+
"cancer_organ": "lung",
|
|
129
|
+
"cancer_type": "lung adenocarcinoma",
|
|
130
|
+
"ONCOTREE_CODE": "LUNG",
|
|
131
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/doiJNLP-TCGA-LUAD-01-30-2017.tcia", # None for default
|
|
132
|
+
"metadata_url": None, # None for default
|
|
133
|
+
"totalsegmentator_organs": ["lung_upper_lobe_left", "lung_lower_lobe_left", "lung_upper_lobe_right", "lung_middle_lobe_right", "lung_lower_lobe_right"],
|
|
134
|
+
"clip_min,clip_max": (-1000, 400), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
135
|
+
},
|
|
136
|
+
"tcga-lusc": {
|
|
137
|
+
"project": "tcga",
|
|
138
|
+
"cancer_organ": "lung",
|
|
139
|
+
"cancer_type": "lung squamous cell carcinoma",
|
|
140
|
+
"ONCOTREE_CODE": "LUNG",
|
|
141
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/doiJNLP-TCGA-LUSC-01-30-2017.tcia", # None for default
|
|
142
|
+
"metadata_url": None, # None for default
|
|
143
|
+
"totalsegmentator_organs": ["lung_upper_lobe_left", "lung_lower_lobe_left", "lung_upper_lobe_right", "lung_middle_lobe_right", "lung_lower_lobe_right"],
|
|
144
|
+
"clip_min,clip_max": (-1000, 400), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
145
|
+
},
|
|
146
|
+
"tcga-ov": {
|
|
147
|
+
"project": "tcga",
|
|
148
|
+
"cancer_organ": "ovary",
|
|
149
|
+
"cancer_type": "ovarian serous cystadenocarcinoma",
|
|
150
|
+
"ONCOTREE_CODE": "OVARY",
|
|
151
|
+
"manifest_url": None, # None for default
|
|
152
|
+
"metadata_url": None, # None for default
|
|
153
|
+
"totalsegmentator_organs": [],
|
|
154
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
155
|
+
},
|
|
156
|
+
"tcga-prad": {
|
|
157
|
+
"project": "tcga",
|
|
158
|
+
"cancer_organ": "prostate",
|
|
159
|
+
"cancer_type": "prostate adenocarcinoma",
|
|
160
|
+
"ONCOTREE_CODE": "PROSTATE",
|
|
161
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/doiJNLP-Pz8ET39p.tcia", # None for default
|
|
162
|
+
"metadata_url": None, # None for default
|
|
163
|
+
"totalsegmentator_organs": ["prostate"],
|
|
164
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
165
|
+
},
|
|
166
|
+
"tcga-read": {
|
|
167
|
+
"project": "tcga",
|
|
168
|
+
"cancer_organ": "rectum",
|
|
169
|
+
"cancer_type": "rectum adenocarcinoma",
|
|
170
|
+
"ONCOTREE_CODE": "BOWEL",
|
|
171
|
+
"manifest_url": None, # None for default
|
|
172
|
+
"metadata_url": None, # None for default
|
|
173
|
+
"totalsegmentator_organs": ["colon"],
|
|
174
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
175
|
+
},
|
|
176
|
+
"tcga-stad": {
|
|
177
|
+
"project": "tcga",
|
|
178
|
+
"cancer_organ": "stomach",
|
|
179
|
+
"cancer_type": "stomach adenocarcinoma",
|
|
180
|
+
"ONCOTREE_CODE": "STOMACH",
|
|
181
|
+
"manifest_url": None, # None for default
|
|
182
|
+
"metadata_url": None, # None for default
|
|
183
|
+
"totalsegmentator_organs": ["stomach"],
|
|
184
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
185
|
+
},
|
|
186
|
+
"tcga-ucec": {
|
|
187
|
+
"project": "tcga",
|
|
188
|
+
"cancer_organ": "uterus",
|
|
189
|
+
"cancer_type": "uterine corpus endometrial carcinoma",
|
|
190
|
+
"ONCOTREE_CODE": "UTERUS",
|
|
191
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA_TCGA-UCEC-2018-10-24.tcia", # None for default
|
|
192
|
+
"metadata_url": None, # None for default
|
|
193
|
+
"totalsegmentator_organs": [],
|
|
194
|
+
"clip_min,clip_max": (-200, 300), # (min, max) to clip pixel values to before resampling and feature extraction - set to (None, None) for no clipping
|
|
195
|
+
},
|
|
196
|
+
"cptac-ccrcc": {
|
|
197
|
+
"project": "cptac",
|
|
198
|
+
"cancer_organ": "kidney",
|
|
199
|
+
"cancer_type": "clear cell renal cell carcinoma",
|
|
200
|
+
"ONCOTREE_CODE": "KIDNEY",
|
|
201
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-CCRCC_v11_20230818.tcia",
|
|
202
|
+
"metadata_url": None,
|
|
203
|
+
"totalsegmentator_organs": ["kidney_left", "kidney_right"],
|
|
204
|
+
"clip_min,clip_max": (-200, 300),
|
|
205
|
+
},
|
|
206
|
+
# "cptac-ucec": {
|
|
207
|
+
# "project": "cptac",
|
|
208
|
+
# "cancer_organ": "uterus",
|
|
209
|
+
# "cancer_type": "uterine corpus endometrial carcinoma",
|
|
210
|
+
# "ONCOTREE_CODE": "UTERUS",
|
|
211
|
+
# "manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-UCEC_v12_20240405b.tcia",
|
|
212
|
+
# "metadata_url": None, #!!! truly doesn't exist - TODO: make a custom one after downloading DICOMs
|
|
213
|
+
# "totalsegmentator_organs": [],
|
|
214
|
+
# "clip_min,clip_max": (-200, 300),
|
|
215
|
+
# },
|
|
216
|
+
"cptac-luad": {
|
|
217
|
+
"project": "cptac",
|
|
218
|
+
"cancer_organ": "lung",
|
|
219
|
+
"cancer_type": "lung adenocarcinoma",
|
|
220
|
+
"ONCOTREE_CODE": "LUNG",
|
|
221
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-LUAD_v13_20250801.tcia",
|
|
222
|
+
"metadata_url": None,
|
|
223
|
+
"totalsegmentator_organs": ["lung_upper_lobe_left", "lung_lower_lobe_left", "lung_upper_lobe_right", "lung_middle_lobe_right", "lung_lower_lobe_right"],
|
|
224
|
+
"clip_min,clip_max": (-1000, 400),
|
|
225
|
+
},
|
|
226
|
+
"cptac-lscc": {
|
|
227
|
+
"project": "cptac",
|
|
228
|
+
"cancer_organ": "lung",
|
|
229
|
+
"cancer_type": "lung squamous cell carcinoma",
|
|
230
|
+
"ONCOTREE_CODE": "LUNG",
|
|
231
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-LSCC_v15.tcia",
|
|
232
|
+
"metadata_url": None,
|
|
233
|
+
"totalsegmentator_organs": ["lung_upper_lobe_left", "lung_lower_lobe_left", "lung_upper_lobe_right", "lung_middle_lobe_right", "lung_lower_lobe_right"],
|
|
234
|
+
"clip_min,clip_max": (-1000, 400),
|
|
235
|
+
},
|
|
236
|
+
# "cptac-hnscc": {
|
|
237
|
+
# "project": "cptac",
|
|
238
|
+
# "cancer_organ": "head_neck",
|
|
239
|
+
# "cancer_type": "head and neck squamous cell carcinoma",
|
|
240
|
+
# "ONCOTREE_CODE": "HEAD_NECK",
|
|
241
|
+
# "manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-HNSCC_v19_20250226.tcia",
|
|
242
|
+
# "metadata_url": None,
|
|
243
|
+
# "totalsegmentator_organs": ["lung_upper_lobe_left", "lung_lower_lobe_left", "lung_upper_lobe_right", "lung_middle_lobe_right", "lung_lower_lobe_right"],
|
|
244
|
+
# "clip_min,clip_max": (-1000, 400),
|
|
245
|
+
# },
|
|
246
|
+
# "cptac-gbm": {
|
|
247
|
+
# "project": "cptac",
|
|
248
|
+
# "cancer_organ": "brain",
|
|
249
|
+
# "cancer_type": "glioblastoma multiforme",
|
|
250
|
+
# "ONCOTREE_CODE": "BRAIN",
|
|
251
|
+
# "manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-GBM_v16_20240708.tcia",
|
|
252
|
+
# "metadata_url": None,
|
|
253
|
+
# "totalsegmentator_organs": ["brain"],
|
|
254
|
+
# "clip_min,clip_max": (-200, 300),
|
|
255
|
+
# },
|
|
256
|
+
"cptac-aml": {
|
|
257
|
+
"project": "cptac",
|
|
258
|
+
"cancer_organ": "blood",
|
|
259
|
+
"cancer_type": "acute myeloid leukemia",
|
|
260
|
+
"ONCOTREE_CODE": "MYELOID",
|
|
261
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/CPTAC-AML_V5_20250415-1.tcia",
|
|
262
|
+
"metadata_url": None,
|
|
263
|
+
"totalsegmentator_organs": [],
|
|
264
|
+
"clip_min,clip_max": (-200, 300),
|
|
265
|
+
},
|
|
266
|
+
# "cptac-stad": {
|
|
267
|
+
# "project": "cptac",
|
|
268
|
+
# "cancer_organ": "stomach",
|
|
269
|
+
# "cancer_type": "stomach adenocarcinoma",
|
|
270
|
+
# "ONCOTREE_CODE": "STOMACH",
|
|
271
|
+
# "manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/CPTAC-STAD_v1_20260304.tcia",
|
|
272
|
+
# "metadata_url": None, #!!! truly doesn't exist - TODO: make a custom one after downloading DICOMs
|
|
273
|
+
# "totalsegmentator_organs": ["stomach"],
|
|
274
|
+
# "clip_min,clip_max": (-200, 300),
|
|
275
|
+
# },
|
|
276
|
+
"cptac-pda": {
|
|
277
|
+
"project": "cptac",
|
|
278
|
+
"cancer_organ": "pancreas",
|
|
279
|
+
"cancer_type": "pancreatic ductal adenocarcinoma",
|
|
280
|
+
"ONCOTREE_CODE": "PANCREAS",
|
|
281
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-PDA_v15_20250226.tcia",
|
|
282
|
+
"metadata_url": None,
|
|
283
|
+
"totalsegmentator_organs": ["pancreas"],
|
|
284
|
+
"clip_min,clip_max": (-200, 300),
|
|
285
|
+
},
|
|
286
|
+
"cptac-cm": {
|
|
287
|
+
"project": "cptac",
|
|
288
|
+
"cancer_organ": "skin",
|
|
289
|
+
"cancer_type": "cutaneous melanoma",
|
|
290
|
+
"ONCOTREE_CODE": "SKIN",
|
|
291
|
+
"manifest_url": "https://www.cancerimagingarchive.net/wp-content/uploads/TCIA-CPTAC-CM_v11_20240429.tcia",
|
|
292
|
+
"metadata_url": None,
|
|
293
|
+
"totalsegmentator_organs": [],
|
|
294
|
+
"clip_min,clip_max": (-200, 300),
|
|
295
|
+
},
|
|
296
|
+
# add more datasets here as needed
|
|
297
|
+
}
|