-
Notifications
You must be signed in to change notification settings - Fork 3
/
HCP_automated_DPARSFA_tryCatch.sh
338 lines (308 loc) · 30 KB
/
HCP_automated_DPARSFA_tryCatch.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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#!/bin/bash
# This script is used to execute all necessary command for preprocessing and processing of a subject from HCP.
# The script should be run as follows:
#
# ./HCP_automated ###### tca11b
#
# The script functions by creating another script, echoing commands with the subject number into that script,
# executing the script, and then deleting the script. At this time large portions of data are left in the
# HCP_data folder for each subject. This should be removed for future use.
# Make directories for data
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/
# make directory for holding results
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"
# Download data via AWS
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/
#/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/RibbonVolumeToSurfaceMapping/goodvoxels.nii.gz goodvoxels.nii.gz
#/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/rfMRI_REST1_RL_hp2000_clean.nii.gz rfMRI_REST1_RL_hp2000_clean.nii.gz
#/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/brainmask_fs.2.nii.gz brainmask_fs.2.nii.gz
#/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/Movement_Regressors.txt Movement_Regressors.txt
#/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/CSFReg.2.nii.gz CSFReg.2.nii.gz
#/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/WMReg.2.nii.gz WMReg.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess-temp/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/RibbonVolumeToSurfaceMapping/goodvoxels.nii.gz goodvoxels.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess-temp/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/rfMRI_REST1_RL_hp2000_clean.nii.gz rfMRI_REST1_RL_hp2000_clean.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess-temp/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/brainmask_fs.2.nii.gz brainmask_fs.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess-temp/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_RL/Movement_Regressors.txt Movement_Regressors.txt
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess-temp/HCP_1200/"$1"/MNINonLinear/ROIs/CSFReg.2.nii.gz CSFReg.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess-temp/HCP_1200/"$1"/MNINonLinear/ROIs/WMReg.2.nii.gz WMReg.2.nii.gz
# Move files into architecture consistent with DPARSFA
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/FunImgARW/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/FunImgARW/Subject001/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/RealignParameter/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/RealignParameter/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/rfMRI_REST1_RL_hp2000_clean.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/FunImgARW/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/brainmask_fs.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/CSFReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/WMReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/Movement_Regressors.txt /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/RealignParameter/Subject001/
# gunzip DPARSFA files
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/FunImgARW/Subject001/rfMRI_REST1_RL_hp2000_clean.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/brainmask_fs.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii.gz
# rename files as necessary
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_CSF.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_WM.nii
# call matlab command and move output to final destination
matlab -wait -nosplash -nojvm -nodisplay -r "cd('C:\Users\tca11b\Desktop\HCP\HCP_functions'); try; DPARSFA_processing_05202018('C:\Users\\"$2"\Desktop\HCP\HCP_data\\"$1"\rfMRI_REST1_RL\DPARSFA'); catch; quit; end; quit"
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/DPARSFA/FunImgARWFC/Subject001/CovRegressed_4DVolume.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/
# gunzip in HCP_process architecture (1_RL)
# gunzip rfMRI_REST1_RL_hp2000_clean.nii.gz (No longer needed, use CovRegressed_4DVolume.nii)
gunzip goodvoxels.nii.gz
# gunzip brainmask_fs.2.nii.gz
# gunzip CSFReg.2.nii.gz
# gunzip WMReg.2.nii.gz
# copy needed functions to data directory and begin processing (1_RL)
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_functions/* /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_RL/
./roi_preprocess_05202018 CovRegressed_4DVolume.nii AAL627_10202016.nii goodvoxels.nii basal_ganglion_06302016.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/goodvoxels_new.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/goodvoxels_new1_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/mean_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/mean_data1_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/snr_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/snr_data1_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/roi_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/roi_data1_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/mc.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/meancenter1_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/voxels_summary.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/voxels_summary1_RL.csv
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/csv_read
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/csv_read.c
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/nifti1.h
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/roi_preprocess_05202018
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/roi_preprocess_05202018.cpp
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/AAL627_10202016.nii
#rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/rfMRI_REST1_RL_hp2000_clean.nii
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_RL/goodvoxels.nii
##
## 2_RL
##
# Download data via AWS
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_RL/RibbonVolumeToSurfaceMapping/goodvoxels.nii.gz goodvoxels.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_RL/rfMRI_REST2_RL_hp2000_clean.nii.gz rfMRI_REST2_RL_hp2000_clean.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_RL/brainmask_fs.2.nii.gz brainmask_fs.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_RL/Movement_Regressors.txt Movement_Regressors.txt
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/CSFReg.2.nii.gz CSFReg.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/WMReg.2.nii.gz WMReg.2.nii.gz
# Move files into architecture consistent with DPARSFA
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/FunImgARW/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/FunImgARW/Subject001/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/RealignParameter/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/RealignParameter/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/rfMRI_REST2_RL_hp2000_clean.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/FunImgARW/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/brainmask_fs.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/CSFReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/WMReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/Movement_Regressors.txt /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/RealignParameter/Subject001/
# gunzip DPARSFA files
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/FunImgARW/Subject001/rfMRI_REST2_RL_hp2000_clean.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/brainmask_fs.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii.gz
# rename files as necessary
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_CSF.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_WM.nii
# call matlab command and move output to final destination
matlab -wait -nosplash -nojvm -nodisplay -r "cd('C:\Users\tca11b\Desktop\HCP\HCP_functions'); try; DPARSFA_processing_05202018('C:\Users\\"$2"\Desktop\HCP\HCP_data\\"$1"\rfMRI_REST2_RL\DPARSFA'); catch; quit; end; quit"
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/DPARSFA/FunImgARWFC/Subject001/CovRegressed_4DVolume.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/
# gunzip in HCP_process architecture (2_RL)
# gunzip rfMRI_REST2_RL_hp2000_clean.nii.gz (No longer needed, use CovRegressed_4DVolume.nii)
gunzip goodvoxels.nii.gz
# gunzip brainmask_fs.2.nii.gz
# gunzip CSFReg.2.nii.gz
# gunzip WMReg.2.nii.gz
# copy needed functions to data directory and begin processing (2_RL)
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_functions/* /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_RL/
./roi_preprocess_05202018 CovRegressed_4DVolume.nii AAL627_10202016.nii goodvoxels.nii basal_ganglion_06302016.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/goodvoxels_new.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/goodvoxels_new2_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/mean_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/mean_data2_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/snr_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/snr_data2_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/roi_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/roi_data2_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/mc.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/meancenter2_RL.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/voxels_summary.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/voxels_summary2_RL.csv
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/csv_read
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/csv_read.c
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/nifti1.h
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/roi_preprocess_05202018
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/roi_preprocess_05202018.cpp
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/AAL627_10202016.nii
#rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/rfMRI_REST2_RL_hp2000_clean.nii
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_RL/goodvoxels.nii
# change to resutls and concatenate processed results
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/
cat meancenter2_RL.csv meancenter2_RL.csv > meancenter_RL.csv
#
# :1_LR
#
# Download data via AWS
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_LR/RibbonVolumeToSurfaceMapping/goodvoxels.nii.gz goodvoxels.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_hp2000_clean.nii.gz rfMRI_REST1_LR_hp2000_clean.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_LR/brainmask_fs.2.nii.gz brainmask_fs.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST1_LR/Movement_Regressors.txt Movement_Regressors.txt
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/CSFReg.2.nii.gz CSFReg.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/WMReg.2.nii.gz WMReg.2.nii.gz
# Move files into architecture consistent with DPARSFA
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/FunImgARW/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/FunImgARW/Subject001/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/RealignParameter/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/RealignParameter/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/rfMRI_REST1_LR_hp2000_clean.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/FunImgARW/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/brainmask_fs.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/CSFReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/WMReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/Movement_Regressors.txt /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/RealignParameter/Subject001/
# gunzip DPARSFA files
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/FunImgARW/Subject001/rfMRI_REST1_LR_hp2000_clean.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/brainmask_fs.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii.gz
# rename files as necessary
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_CSF.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_WM.nii
# call matlab command and move output to final destination
matlab -wait -nosplash -nojvm -nodisplay -r "cd('C:\Users\tca11b\Desktop\HCP\HCP_functions'); try; DPARSFA_processing_05202018('C:\Users\\"$2"\Desktop\HCP\HCP_data\\"$1"\rfMRI_REST1_LR\DPARSFA'); catch; quit; end; quit"
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/DPARSFA/FunImgARWFC/Subject001/CovRegressed_4DVolume.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/
# gunzip in HCP_process architecture (1_LR)
# gunzip rfMRI_REST1_LR_hp2000_clean.nii.gz (No longer needed, use CovRegressed_4DVolume.nii)
gunzip goodvoxels.nii.gz
# gunzip brainmask_fs.2.nii.gz
# gunzip CSFReg.2.nii.gz
# gunzip WMReg.2.nii.gz
# copy needed functions to data directory and begin processing (1_LR)
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_functions/* /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST1_LR/
./roi_preprocess_05202018 CovRegressed_4DVolume.nii AAL627_10202016.nii goodvoxels.nii basal_ganglion_06302016.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/goodvoxels_new.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/goodvoxels_new1_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/mean_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/mean_data1_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/snr_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/snr_data1_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/roi_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/roi_data1_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/mc.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/meancenter1_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/voxels_summary.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/voxels_summary1_LR.csv
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/csv_read
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/csv_read.c
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/nifti1.h
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/roi_preprocess_05202018
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/roi_preprocess_05202018.cpp
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/AAL627_10202016.nii
#rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/rfMRI_REST1_LR_hp2000_clean.nii
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST1_LR/goodvoxels.nii
#
# 2_LR
#
# Download data via AWS
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_LR/RibbonVolumeToSurfaceMapping/goodvoxels.nii.gz goodvoxels.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_LR/rfMRI_REST2_LR_hp2000_clean.nii.gz rfMRI_REST2_LR_hp2000_clean.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_LR/brainmask_fs.2.nii.gz brainmask_fs.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_900/"$1"/MNINonLinear/Results/rfMRI_REST2_LR/Movement_Regressors.txt Movement_Regressors.txt
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/CSFReg.2.nii.gz CSFReg.2.nii.gz
/cygdrive/c/Program\ Files/Amazon/AWSCLI/aws s3 cp s3://hcp-openaccess/HCP_1200/"$1"/MNINonLinear/ROIs/WMReg.2.nii.gz WMReg.2.nii.gz
# Move files into architecture consistent with DPARSFA
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/FunImgARW/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/FunImgARW/Subject001/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/RealignParameter/
mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/RealignParameter/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/rfMRI_REST2_LR_hp2000_clean.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/FunImgARW/Subject001/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/brainmask_fs.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/CSFReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/WMReg.2.nii.gz /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/Movement_Regressors.txt /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/RealignParameter/Subject001/
# gunzip DPARSFA files
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/FunImgARW/Subject001/rfMRI_REST2_LR_hp2000_clean.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/brainmask_fs.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii.gz
gunzip /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii.gz
# rename files as necessary
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/CSFReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_CSF.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/WMReg.2.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/Masks/SegmentationMasks/MNIFunSpace_ThrdMask_Subject001_WM.nii
# call matlab command and move output to final destination
matlab -wait -nosplash -nojvm -nodisplay -r "cd('C:\Users\tca11b\Desktop\HCP\HCP_functions'); try; DPARSFA_processing_05202018('C:\Users\\"$2"\Desktop\HCP\HCP_data\\"$1"\rfMRI_REST2_LR\DPARSFA'); catch; quit; end; quit"
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/DPARSFA/FunImgARWFC/Subject001/CovRegressed_4DVolume.nii /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/
# gunzip in HCP_process architecture (2_LR)
# gunzip rfMRI_REST2_LR_hp2000_clean.nii.gz (No longer needed, use CovRegressed_4DVolume.nii)
gunzip goodvoxels.nii.gz
# gunzip brainmask_fs.2.nii.gz
# gunzip CSFReg.2.nii.gz
# gunzip WMReg.2.nii.gz
# copy needed functions to data directory and begin processing (2_LR)
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/
cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_functions/* /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/rfMRI_REST2_LR/
./roi_preprocess_05202018 CovRegressed_4DVolume.nii AAL627_10202016.nii goodvoxels.nii basal_ganglion_06302016.nii
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/goodvoxels_new.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/goodvoxels_new2_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/mean_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/mean_data2_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/snr_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/snr_data2_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/roi_data.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/roi_data2_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/mc.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/meancenter2_LR.csv
mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/voxels_summary.csv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/voxels_summary2_LR.csv
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/csv_read
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/csv_read.c
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/nifti1.h
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/roi_preprocess_05202018
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/roi_preprocess_05202018.cpp
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/AAL627_10202016.nii
#rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/rfMRI_REST2_LR_hp2000_clean.nii
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/$1/rfMRI_REST2_LR/goodvoxels.nii
# concatenate meancentered data
cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/
cat meancenter1_LR.csv meancenter2_LR.csv > meancenter_LR.csv
# remove unnecessary files
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/voxel*
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/mean_*
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/mean_*
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/meancenter1*
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/meancenter2*
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/snr*
rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/goodvoxels*
rm -r /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"/*
#
# Generate FC matrices
#
matlab -wait -nosplash -nojvm -nodisplay -r "cd('C:\Users\tca11b\Desktop\HCP\HCP_functions'); try; fcMat = fcMat_generation_05202018('C:\Users\\"$2"\Desktop\HCP\HCP_results\\"$1"\meancenter_RL.csv'); csvwrite('C:\Users\\"$2"\Desktop\HCP\HCP_results\\"$1"\fcMat_RL.csv',fcMat); fcMat = fcMat_generation_05202018('C:\Users\\"$2"\Desktop\HCP\HCP_results\\"$1"\meancenter_LR.csv'); csvwrite('C:\Users\\"$2"\Desktop\HCP\HCP_results\\"$1"\fcMat_LR.csv',fcMat); fcMat = fcMat_generation_05202018('C:\Users\\"$2"\Desktop\HCP\HCP_results\\"$1"\meancenter_LR.csv'); csvwrite('C:\Users\\"$2"\Desktop\HCP\HCP_results\\"$1"\fcMat_LR.csv',fcMat); catch; quit; end; quit"
# CALCULATES FC matrices
# # calculate correlation matrices
# cp /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_functions/* /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/
# ./csv_read meancenter_RL.csv
# mv fcMap.csv fcMap_RL.csv
# ./csv_read meancenter_LR.csv
# mv fcMap.csv fcMap_LR.csv
#
# # remove functions
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/csv_read
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/csv_read.c
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/nifti1.h
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/roi_preprocess_05202018
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/roi_preprocess_05202018.cpp
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/AAL627_10202016.nii
#
# # remove extraneous data files
# rm goodvoxels* meancenter*
#
# # compress data files
# mkdir /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/compressed_data/
# mv roi_data* /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/compressed_data/
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/snr_data*
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/mean_data*
# rm /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/basal_ganglion_06302016.nii
# #echo zip compressed_data.zip compressed_data/
# #echo rm -R /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_results/"$1"/compressed_data
#
# # move data files to HCP_raw_data and delete zipped downloads
# #echo mv /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1" /cygdrive/c/HCP_raw_data/
# cd /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/
# rm -R /cygdrive/c/Users/"$2"/Desktop/HCP/HCP_data/"$1"
#