-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_hcp7.sh
executable file
·284 lines (229 loc) · 9.99 KB
/
init_hcp7.sh
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#!/bin/bash
SUB=$1
OUT=$2
ID_0009=102311
ID_0010=109123
ID_0011=111312
ID_0012=125525
ID=$(eval echo "\$ID_$SUB")
SRC=/N/dc2/projects/lifebid/HCP7
### PREPROCESS ANAT
#
#mkdir -p ${OUT}/derivatives/preprocess/sub-${SUB}/anat
#
#cp ${SRC}/${ID}/anatomy/T1w_acpc_dc_restore_1.05_ACPC.nii.gz \
# ${OUT}/derivatives/preprocess/sub-${SUB}/anat/sub-${SUB}_T1w.nii.gz
#
#
#### PREPROCESS DWI
#
#DWI=data_b2000_aligned_trilin_noMEC
#
#mkdir -p ${OUT}/derivatives/preprocess/sub-${SUB}/dwi
#
#cp ${SRC}/${ID}/dt6/${DWI}.nii.gz \
# ${OUT}/derivatives/preprocess/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi.nii.gz
#cp ${SRC}/${ID}/dt6/${DWI}.bvals \
# ${OUT}/derivatives/preprocess/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi.bvals
#cp ${SRC}/${ID}/dt6/${DWI}.bvecs \
# ${OUT}/derivatives/preprocess/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi.bvecs
#cp ${SRC}/${ID}/dt6/dti64trilin/bin/brainMask.nii.gz \
# ${OUT}/derivatives/preprocess/sub-${SUB}/dwi/sub-${SUB}_dwi_brainmask.nii.gz
#
#
#### RECON MODELS
#
#mkdir -p ${OUT}/derivatives/recon_models/sub-${SUB}/anat
#
#cp ${SRC}/${ID}/dt6/dti64trilin/bin/wmMask.nii.gz \
# ${OUT}/derivatives/recon_models/sub-${SUB}/anat/sub-${SUB}_T1_wmmask.nii.gz
#
#mkdir -p ${OUT}/O3D_HCP7T/derivatives/recon_models/sub-${SUB}/dwi
#
#mrconvert ${SRC}/${ID}/tractography/data_b2000_aligned_trilin_noMEC_dt.mif \
# ${OUT}/derivatives/recon_models/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi_DTI.nii.gz \
# -force
#mrconvert ${SRC}/${ID}/tractography/data_b2000_aligned_trilin_noMEC_ev.mif \
# ${OUT}/derivatives/recon_models/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi_EV.nii.gz \
# -force
#mrconvert ${SRC}/${ID}/tractography/data_b2000_aligned_trilin_noMEC_fa.mif \
# ${OUT}/derivatives/recon_models/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi_FA.nii.gz \
# -force
#mrconvert ${SRC}/${ID}/tractography/data_b2000_aligned_trilin_noMEC_lmax8.mif \
# ${OUT}/derivatives/recon_models/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi_ODF.nii.gz \
# -force
#cp ${SRC}/${ID}/tractography/data_b2000_aligned_trilin_noMEC_response.txt \
# ${OUT}/derivatives/recon_models/sub-${SUB}/dwi/sub-${SUB}_b-2000_dwi_dwiresponse.txt
### TRACTOGRAPHY
TCK=data_b2000_aligned_trilin_noMEC
mkdir -p ${OUT}/derivatives/tracking_dtidet_tck/sub-${SUB}
for N in 01 02 03 04 05 06 07 08 09 10; do
cp ${SRC}/${ID}/tractography/${TCK}_wm_tensor-NUM${N}-500000.tck \
${OUT}/derivatives/tracking_dtidet_tck/sub-${SUB}/sub-${SUB}_dwi_var-dtidet_run-${N}_tract.tck
done
mkdir -p ${OUT}/derivatives/tracking_csddet_tck/sub-${SUB}
for N in 01 02 03 04 05 06 07 08 09 10; do
cp ${SRC}/${ID}/tractography/${TCK}_csd_lmax8_wm_SD_STREAM-NUM${N}-500000.tck \
${OUT}/derivatives/tracking_csddet_tck/sub-${SUB}/sub-${SUB}_dwi_var-csddet_run-${N}_tract.tck
done
mkdir -p ${OUT}/derivatives/tracking_csdprob_tck/sub-${SUB}
for N in 01 02 03 04 05 06 07 08 09 10; do
cp ${SRC}/${ID}/tractography/${TCK}_csd_lmax8_wm_SD_PROB-NUM${N}-500000.tck \
${OUT}/derivatives/tracking_csdprob_tck/sub-${SUB}/sub-${SUB}_dwi_var-csdprob_run-${N}_tract.tck
done
REF=${OUT}/derivatives/preprocess/sub-${SUB}/dwi/sub-${SUB}_dwi_brainmask.nii.gz
mkdir -p ${OUT}/derivatives/tracking_dtidet_trk/sub-${SUB}
TCK=${OUT}/derivatives/tracking_dtidet_tck/sub-${SUB}
TRK=${OUT}/derivatives/tracking_dtidet_trk/sub-${SUB}
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TCK}/sub-${SUB}_dwi_var-dtidet_run-${N}_tract.tck \
-o ${TRK}/sub-${SUB}_dwi_var-dtidet_run-${N}_tract.trk \
-a ${REF} -f
done
mkdir -p ${OUT}/derivatives/tracking_csddet_trk/sub-${SUB}
TCK=${OUT}/derivatives/tracking_csddet_tck/sub-${SUB}
TRK=${OUT}/derivatives/tracking_csddet_trk/sub-${SUB}
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TCK}/sub-${SUB}_dwi_var-csddet_run-${N}_tract.tck \
-o ${TRK}/sub-${SUB}_dwi_var-csddet_run-${N}_tract.trk \
-a ${REF} -f
done
mkdir -p ${OUT}/derivatives/tracking_csdprob_trk/sub-${SUB}
TCK=${OUT}/derivatives/tracking_csdprob_tck/sub-${SUB}
TRK=${OUT}/derivatives/tracking_csdprob_trk/sub-${SUB}
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TCK}/sub-${SUB}_dwi_var-csdprob_run-${N}_tract.tck \
-o ${TRK}/sub-${SUB}_dwi_var-csdprob_run-${N}_tract.trk \
-a ${REF} -f
done
exit
### LIFE STRUCT
FE=/N/dc2/projects/lifebid/code/ccaiafa/Caiafa_Pestilli_paper2015/Revision_Feb2017/Results/Single_TC/fe_structures
mkdir -p ${OUT}/O3D_HCP7T/derivatives/life_struct/sub-${SUB}/dwi
for N in 01 02 03 04 05 06 07 08 09 10; do
cp ${FE}/7t_${ID}/fe_structure_${ID}_STC_run01_tensor__connNUM${N}.mat \
${OUT}/O3D_HCP7T/derivatives/life_struct/sub-${SUB}/dwi/sub-${SUB}_dwi_var-dtidetlife_run-${N}_life.mat
done
for N in 01 02 03 04 05 06 07 08 09 10; do
cp ${FE}/7t_${ID}/fe_structure_${ID}_STC_run01_SD_STREAM_lmax8_connNUM${N}.mat \
${OUT}/O3D_HCP7T/derivatives/life_struct/sub-${SUB}/dwi/sub-${SUB}_dwi_var-csddetlife_run-${N}_life.mat
done
for N in 01 02 03 04 05 06 07 08 09 10; do
cp ${FE}/7t_${ID}/fe_structure_${ID}_STC_run01_SD_PROB_lmax8_connNUM${N}.mat \
${OUT}/O3D_HCP7T/derivatives/life_struct/sub-${SUB}/dwi/sub-${SUB}_dwi_var-csdproblife_run-${N}_life.mat
done
### LIFE TRACTOGRAPHY
FE=${OUT}/O3D_HCP7T/derivatives/life_struct/sub-${SUB}/dwi
ADD1="addpath(genpath('/N/dc2/projects/lifebid/Paolo/local/matlab'))"
ADD2="addpath(genpath('/N/dc2/projects/o3d/code/utils'))"
VAR=dtidet
PRE=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
mkdir -p ${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
for N in 01 02 03 04 05 06 07 08 09 10; do
MAT=${FE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_life.mat
TRK=${PRE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.trk
RAS=${PRE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract_RAS.trk
CMD="fe2trk $MAT $REF $RAS"
matlab -nojvm -nodesktop -nosplash -r "${ADD1};${ADD2};${CMD};exit"
TractConverter.py -i $RAS -o $TRK -a $REF -f
rm $RAS
done
VAR=csddet
PRE=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
mkdir -p ${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
for N in 01 02 03 04 05 06 07 08 09 10; do
MAT=${FE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_life.mat
TRK=${PRE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.trk
RAS=${PRE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract_RAS.trk
CMD="fe2trk $MAT $REF $RAS"
matlab -nojvm -nodesktop -nosplash -r "${ADD1};${ADD2};${CMD};exit"
TractConverter.py -i $RAS -o $TRK -a $REF -f
rm $RAS
done
VAR=csdprob
PRE=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
mkdir -p ${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
for N in 01 02 03 04 05 06 07 08 09 10; do
MAT=${FE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_life.mat
TRK=${PRE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.trk
RAS=${PRE}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract_RAS.trk
CMD="fe2trk $MAT $REF $RAS"
matlab -nojvm -nodesktop -nosplash -r "${ADD1};${ADD2};${CMD};exit"
TractConverter.py -i $RAS -o $TRK -a $REF -f
rm $RAS
done
VAR=dtidet
mkdir -p ${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_tck
TCK=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_tck/sub-${SUB}/dwi
TRK=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TRK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.trk \
-o ${TCK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.tck \
-a ${REF} -f
done
VAR=csddet
mkdir -p ${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_tck
TCK=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_tck/sub-${SUB}/dwi
TRK=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TRK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.trk \
-o ${TCK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.tck \
-a ${REF} -f
done
VAR=csdprob
mkdir -p ${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_tck
TCK=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_tck/sub-${SUB}/dwi
TRK=${OUT}/O3D_HCP7T/derivatives/tracking_${VAR}_trk/sub-${SUB}/dwi
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TRK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.trk \
-o ${TCK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_tract.tck \
-a ${REF} -f
done
### AFQ DISSECTION
/N/dc2/projects/o3d/code/init_dissection_fe2trk.sh HCP7T ${SUB} test3 dtidet
/N/dc2/projects/o3d/code/init_dissection_fe2trk.sh HCP7T ${SUB} test3 csddet
/N/dc2/projects/o3d/code/init_dissection_fe2trk.sh HCP7T ${SUB} test3 csdprob
SET='ATRl ATRr CSTl CSTr CCgl CCgr CHyl CHyr FMJ FMI IFOFl IFOFr ILFl ILFr SLFl SLFr UFl UFr ARCl ARCr'
VAR=dtidet
TCK=${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_tck/sub-${SUB}/dwi/
TRK=${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_trk/sub-${SUB}/dwi/
mkdir -p ${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_tck/sub-${SUB}/dwi
for S in $SET; do
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TRK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_var-afq_set-${S}_tract.trk \
-o ${TCK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_var-afq_set-${S}_tract.tck \
-a ${REF} -f
done
done
VAR=csddet
TCK=${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_tck/sub-${SUB}/dwi/
TRK=${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_trk/sub-${SUB}/dwi/
mkdir -p ${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_tck/sub-${SUB}/dwi
for S in $SET; do
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TRK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_var-afq_set-${S}_tract.trk \
-o ${TCK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_var-afq_set-${S}_tract.tck \
-a ${REF} -f
done
done
VAR=csdprob
TCK=${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_tck/sub-${SUB}/dwi/
TRK=${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_trk/sub-${SUB}/dwi/
mkdir -p ${OUT}/O3D_HCP7T/derivatives/dissection_${VAR}_tck/sub-${SUB}/dwi
for S in $SET; do
for N in 01 02 03 04 05 06 07 08 09 10; do
TractConverter.py \
-i ${TRK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_var-afq_set-${S}_tract.trk \
-o ${TCK}/sub-${SUB}_dwi_var-${VAR}life_run-${N}_var-afq_set-${S}_tract.tck \
-a ${REF} -f
done
done
### CONNECTOME