-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfsOneHotEncoding.py
More file actions
126 lines (120 loc) · 5.61 KB
/
fsOneHotEncoding.py
File metadata and controls
126 lines (120 loc) · 5.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
def fsDicts():
# Hardcoded lookup table for the Freesurfer label names
# from $FREESURFER_HOME/FreeSurferColorLUT.txt
fsLabelDict={
0 : 'Null' ,
1 : 'Left-Cerebral-Exterior' ,
2 : 'Left-Cerebral-White-Matter' ,
3 : 'Left-Cerebral-Cortex' ,
4 : 'Left-Lateral-Ventricle' ,
5 : 'Left-Inf-Lat-Vent' ,
6 : 'Left-Cerebellum-Exterior' ,
7 : 'Left-Cerebellum-White-Matter' ,
8 : 'Left-Cerebellum-Cortex' ,
9 : 'Left-Thalamus-unused' ,
10 : 'Left-Thalamus' ,
11 : 'Left-Caudate' ,
12 : 'Left-Putamen' ,
13 : 'Left-Pallidum' ,
14 : '3rd-Ventricle' ,
15 : '4th-Ventricle' ,
16 : 'Brain-Stem' ,
17 : 'Left-Hippocampus' ,
18 : 'Left-Amygdala' ,
19 : 'Left-Insula' ,
20 : 'Left-Operculum' ,
21 : 'Line-1' ,
22 : 'Line-2' ,
23 : 'Line-3' ,
24 : 'CSF' ,
25 : 'Left-Lesion' ,
26 : 'Left-Accumbens-area' ,
27 : 'Left-Substancia-Nigra' ,
28 : 'Left-VentralDC' ,
29 : 'Left-undetermined' ,
30 : 'Left-vessel' ,
31 : 'Left-choroid-plexus' ,
32 : 'Left-F3orb' ,
33 : 'Left-lOg' ,
34 : 'Left-aOg' ,
35 : 'Left-mOg' ,
36 : 'Left-pOg' ,
37 : 'Left-Stellate' ,
38 : 'Left-Porg' ,
39 : 'Left-Aorg' ,
40 : 'Right-Cerebral-Exterior' ,
41 : 'Right-Cerebral-White-Matter' ,
42 : 'Right-Cerebral-Cortex' ,
43 : 'Right-Lateral-Ventricle' ,
44 : 'Right-Inf-Lat-Vent' ,
45 : 'Right-Cerebellum-Exterior' ,
46 : 'Right-Cerebellum-White-Matter' ,
47 : 'Right-Cerebellum-Cortex' ,
48 : 'Right-Thalamus-unused' ,
49 : 'Right-Thalamus' ,
50 : 'Right-Caudate' ,
51 : 'Right-Putamen' ,
52 : 'Right-Pallidum' ,
53 : 'Right-Hippocampus' ,
54 : 'Right-Amygdala' ,
55 : 'Right-Insula' ,
56 : 'Right-Operculum' ,
57 : 'Right-Lesion' ,
58 : 'Right-Accumbens-area' ,
59 : 'Right-Substancia-Nigra' ,
60 : 'Right-VentralDC' ,
61 : 'Right-undetermined' ,
62 : 'Right-vessel' ,
63 : 'Right-choroid-plexus' ,
64 : 'Right-F3orb' ,
65 : 'Right-lOg' ,
66 : 'Right-aOg' ,
67 : 'Right-mOg' ,
68 : 'Right-pOg' ,
69 : 'Right-Stellate' ,
70 : 'Right-Porg' ,
71 : 'Right-Aorg' ,
72 : '5th-Ventricle' ,
73 : 'Left-Interior' ,
74 : 'Right-Interior' ,
77 : 'WM-hypointensities' ,
78 : 'Left-WM-hypointensities' ,
79 : 'Right-WM-hypointensities' ,
80 : 'non-WM-hypointensities' ,
81 : 'Left-non-WM-hypointensities' ,
82 : 'Right-non-WM-hypointensities' ,
83 : 'Left-F1' ,
84 : 'Right-F1' ,
85 : 'Optic-Chiasm' ,
192 : 'Corpus_Callosum' ,
251 : 'CC_Posterior' ,
252 : 'CC_Mid_Posterior' ,
253 : 'CC_Central' ,
254 : 'CC_Mid_Anterior' ,
255 : 'CC_Anterior' ,
}
fsNamedGroups={
'CerebralWM' : ['Left-Cerebral-White-Matter', 'Right-Cerebral-White-Matter', 'WM-hypointensities'],
'CerebralCortex' : ['Left-Cerebral-Cortex', 'Right-Cerebral-Cortex'],
'CerebellumWM' : ['Left-Cerebellum-White-Matter', 'Right-Cerebellum-White-Matter'],
'CerebellumCortex' : ['Left-Cerebellum-Cortex', 'Right-Cerebellum-Cortex'],
'Thalami' : ['Left-Thalamus', 'Right-Thalamus'],
'BasalGanglia' : ['Left-Accumbens-area', 'Left-Caudate', 'Left-Pallidum', 'Left-Putamen', 'Right-Accumbens-area', 'Right-Caudate', 'Right-Pallidum', 'Right-Putamen'],
'Hippocampi' : ['Left-Amygdala', 'Left-Hippocampus', 'Right-Amygdala', 'Right-Hippocampus'],
'VentralDiencephalon' : ['Left-VentralDC', 'Right-VentralDC'],
'Brainstem' : ['Brain-Stem'],
'Ventricles' : ['Left-Inf-Lat-Vent', 'Right-Inf-Lat-Vent', 'Right-Lateral-Ventricle', 'Left-Lateral-Ventricle', '3rd-Ventricle', '4th-Ventricle'],
'CorpusCallosum' : ['Corpus_Callosum', 'CC_Posterior', 'CC_Mid_Posterior', 'CC_Central', 'CC_Mid_Anterior', 'CC_Anterior'],
'OpticChiasm' : ['Optic-Chiasm'],
'ChoroidPlexus' : ['Left-choroid-plexus', 'Right-choroid-plexus'],
'CSF' : ['CSF'],
'Null' : ['Null'],
}
fsNumberedGroups={}
for group, labelNames in fsNamedGroups.items():
indices = []
for i, labelName in fsLabelDict.items():
if labelName in labelNames:
indices.append(i)
fsNumberedGroups[group] = indices
return fsLabelDict, fsNamedGroups, fsNumberedGroups