-
Notifications
You must be signed in to change notification settings - Fork 0
/
o3d_tree.py
executable file
·165 lines (136 loc) · 6.96 KB
/
o3d_tree.py
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env python
import sys
from os.path import join, isfile
from subprocess import call
def checkExists(path):
if isfile(path):
return 0
else:
print "Missing: " + path
def main(dir_root, ss, ds):
dataset = ['O3D_STN', 'O3D_HCP3T', 'O3D_HCP7T']
subjects = {}
subjects['O3D_STN'] = ['0001', '0002', '0003', '0004']
subjects['O3D_HCP3T'] = ['0005', '0006', '0007', '0008']
subjects['O3D_HCP7T'] = ['0009', '0010', '0011', '0012']
files = ['README',
'CHANGES',
'dataset_description.json',
'participants.csv']
derivatives = 'derivatives'
pipelines = ['preprocess',
# 'freesurfer',
'recon_models',
'tracking_dtidet_trk',
'tracking_csddet_trk',
'tracking_csdprob_trk',
'tracking_dtidet_tck',
'tracking_csddet_tck',
'tracking_csdprob_tck',
'life_struct',
'dissection_afq_dtidet_trk',
'dissection_afq_csddet_trk',
'dissection_afq_csdprob_trk',
'dissection_afq_dtidet_tck',
'dissection_afq_csddet_tck',
'dissection_afq_csdprob_tck',
'connectome_tract']
readme = 'README'
data_dir = {}
data_file = {}
data_dir['preprocess'] = ['anat', 'dwi']
data_file['preprocess', 'anat'] = ['_T1w.nii.gz',
# '_T1w_dtissue.nii.gz',
'_T1w_brainmask.nii.gz']
data_file['preprocess', 'dwi'] = ['_b-2000_dwi.nii.gz',
'_dwi_brainmask.nii.gz',
'_b-2000_dwi.bvals',
'_b-2000_dwi.bvecs']
# data_dir['freesurfer'] = ['anat']
# data_file['freesurfer', 'anat'] = ['_parc-wm_T1w.nii.gz',
# '_aparc_aseg_T1w.nii.gz',
# '_ribbon_T1w.nii.gz']
data_dir['recon_models'] = ['anat', 'dwi']
data_file['recon_models', 'anat'] = ['_T1_wmmask.nii.gz']
data_file['recon_models', 'dwi'] = ['_b-2000_dwi_FA.nii.gz',
'_b-2000_dwi_DTI.nii.gz',
'_b-2000_dwi_ODF.nii.gz',
'_b-2000_dwi_dwiresponse.txt']
data_dir['tracking_dtidet_trk'] = ['dwi']
data_file['tracking_dtidet_trk', 'dwi'] = \
['_dwi_var-dtidet_run-{:02d}_tract.trk'.format(i+1) for i in range(10)] +\
['_dwi_var-dtidetlife_run-{:02d}_tract.trk'.format(i+1) for i in range(10)]
data_dir['tracking_csddet_trk'] = ['dwi']
data_file['tracking_csddet_trk', 'dwi'] = \
['_dwi_var-csddet_run-{:02d}_tract.trk'.format(i+1) for i in range(10)] +\
['_dwi_var-csddetlife_run-{:02d}_tract.trk'.format(i+1) for i in range(10)]
data_dir['tracking_csdprob_trk'] = ['dwi']
data_file['tracking_csdprob_trk', 'dwi'] = \
['_dwi_var-csdprob_run-{:02d}_tract.trk'.format(i+1) for i in range(10)] +\
['_dwi_var-csdproblife_run-{:02d}_tract.trk'.format(i+1) for i in range(10)]
data_dir['tracking_dtidet_tck'] = ['dwi']
data_file['tracking_dtidet_tck', 'dwi'] = \
['_dwi_var-dtidet_run-{:02d}_tract.tck'.format(i+1) for i in range(10)] +\
['_dwi_var-dtidetlife_run-{:02d}_tract.tck'.format(i+1) for i in range(10)]
data_dir['tracking_csddet_tck'] = ['dwi']
data_file['tracking_csddet_tck', 'dwi'] = \
['_dwi_var-csddet_run-{:02d}_tract.tck'.format(i+1) for i in range(10)] +\
['_dwi_var-csddetlife_run-{:02d}_tract.tck'.format(i+1) for i in range(10)]
data_dir['tracking_csdprob_tck'] = ['dwi']
data_file['tracking_csdprob_tck', 'dwi'] = \
['_dwi_var-csdprob_run-{:02d}_tract.tck'.format(i+1) for i in range(10)] +\
['_dwi_var-csdproblife_run-{:02d}_tract.tck'.format(i+1) for i in range(10)]
data_dir['life_struct'] = ['dwi']
data_file['life_struct', 'dwi'] = []
tracts = ['ATRl', 'ATRr', 'CSTl', 'CSTr', 'CCgl', 'CCgr', 'CHyl', 'CHyr', 'FMJ', 'FMI', 'IFOFl', 'IFOFr', 'ILFl', 'ILFr', 'SLFl', 'SLFr', 'UFl', 'UFr', 'ARCl', 'ARCr']
algs = ['csddetlife', 'dtidetlife', 'csdproblife']
data_dir['dissection_afq_dtidet_tck'] = ['dwi']
data_file['dissection_afq_dtidet_tck', 'dwi'] = \
['_dwi_var-dtidetlife_run-{:02d}_tract_var-afq_set-{}_tract.tck'.format(i+1, t) for i in range(10) for t in tracts]
data_dir['dissection_afq_csddet_tck'] = ['dwi']
data_file['dissection_afq_csddet_tck', 'dwi'] = \
['_dwi_var-csddetlife_run-{:02d}_tract_var-afq_set-{}_tract.tck'.format(i+1, t) for i in range(10) for t in tracts]
data_dir['dissection_afq_csdprob_tck'] = ['dwi']
data_file['dissection_afq_csdprob_tck', 'dwi'] = \
['_dwi_var-csdproblife_run-{:02d}_tract_var-afq_set-{}_tract.tck'.format(i+1, t) for i in range(10) for t in tracts]
data_dir['dissection_afq_dtidet_trk'] = ['dwi']
data_file['dissection_afq_dtidet_trk', 'dwi'] = \
['_dwi_var-dtidetlife_run-{:02d}_tract_var-afq_set-{}_tract.trk'.format(i+1, t) for i in range(10) for t in tracts]
data_dir['dissection_afq_csddet_trk'] = ['dwi']
data_file['dissection_afq_csddet_trk', 'dwi'] = \
['_dwi_var-csddetlife_run-{:02d}_tract_var-afq_set-{}_tract.trk'.format(i+1, t) for i in range(10) for t in tracts]
data_dir['dissection_afq_csdprob_trk'] = ['dwi']
data_file['dissection_afq_csdprob_trk', 'dwi'] = \
['_dwi_var-csdproblife_run-{:02d}_tract_var-afq_set-{}_tract.trk'.format(i+1, t) for i in range(10) for t in tracts]
data_dir['connectome_tract'] = ['dwi']
data_file['connectome_tract', 'dwi'] =\
['_dwi_var-dtidetlife_run-{:02d}_var-fcount_connectome.csv'.format(i+1) for i in range(10)] +\
['_dwi_var-csddetlife_run-{:02d}_var-fcount_connectome.csv'.format(i+1) for i in range(10)] +\
['_dwi_var-csdproblife_run-{:02d}_var-fcount_connectome.csv'.format(i+1) for i in range(10)] +\
['_dwi_var-dtidetlife_run-{:02d}_var-fdensity_connectome.csv'.format(i+1) for i in range(10)] +\
['_dwi_var-csddetlife_run-{:02d}_var-fdensity_connectome.csv'.format(i+1) for i in range(10)] +\
['_dwi_var-csdproblife_run-{:02d}_var-fdensity_connectome.csv'.format(i+1) for i in range(10)]
dir_0 = join(dir_root, ds)
for f in files:
filename = join(dir_0, f)
checkExists(filename)
dir_1 = join(dir_0, derivatives)
for pl in pipelines:
dir_2 = join(dir_1, pl)
dir_3 = join(dir_2, 'sub-' + ss)
for dd in data_dir[pl]:
dir_4 = join(dir_3, dd)
for df in data_file[pl, dd]:
filename = join(dir_4, 'sub-' + ss + df)
checkExists(filename)
if __name__ == "__main__":
root = '.'
if len(sys.argv) > 1:
root = sys.argv[1]
sub = 'all'
if len(sys.argv) > 2:
sub = sys.argv[2]
dat = 'all'
if len(sys.argv) > 3:
dat = sys.argv[3]
main(root, sub, dat)