-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.1.ECC_BET.sh
136 lines (84 loc) · 4.6 KB
/
2.1.ECC_BET.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
#!/bin/bash
HOST='compimglab.myqnapcloud.com'
USER='ozgecan_kaplan'
PASSWD='guest123'
echo 'This script applies Eddy Current Correction and Brain Extraction on the input images.'
DTIDir="/home/compimglab/Desktop/DTI/"
B0Dir="/home/compimglab/Desktop/B0/"
T1Dir="/home/compimglab/Desktop/T1/"
##### PD-Patients #######################
for i in "${input_P[@]}"
do
##1. Eddy Current Correction B0 of each patient & DTI of each patient.
cd /home/compimglab/Desktop/DTI/
eddy_correct PD${i} /home/compimglab/Desktop/DTI/PD${i}_ecc 0
cd /home/compimglab/Desktop/B0/
eddy_correct PD${i}_B0 /home/compimglab/Desktop/B0/PD${i}_B0_ecc 0
##2. Extract skull & spine for B0 of each patient.
cd /home/compimglab/Desktop/B0/
t=0.2
bet PD${i}_B0_ecc PD${i}_B0_ecc_brain -m -f $t -g 0
#2.1. Multiply DTI & B0_brain_mask of each patient.
fslmaths "${DTIDir}PD${i}_ecc.nii.gz" -mul "${B0Dir}PD${i}_B0_ecc_brain_mask.nii.gz" "${DTIDir}PD${i}_ecc_brain.nii.gz"
cd /home/compimglab/Desktop/T1/
t1=0.5
bet "PD${i}_T1" "PD${i}_T1_brain" -m -f $t1 -g 0
#Upload Followinf Outputs to Server.
#PD${i}_ecc.nii.gz
#PD${i}_ecc.ecc.log
#PD${i}_ecc_brain.nii.gz
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/DTI/DTI_32/nii/ "${DTIDir}PD${i}_ecc.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/DTI/DTI_32/nii/ "${DTIDir}PD${i}_ecc.ecclog"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/DTI/DTI_32/nii/ "${DTIDir}PD${i}_ecc_brain.nii.gz"
#PD${i}_B0_ecc.nii.gz
#PD${i}_B0_ecc.ecc.log
#PD${i}_B0_ecc_brain.nii.gz
#PD${i}_B0_ecc_brain_mask.nii.gz
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}PD${i}_B0_ecc.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}PD${i}_B0_ecc.ecclog"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}PD${i}_B0_ecc_brain.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}PD${i}_B0_ecc_brain_mask.nii.gz"
#PD${i}_T1_brain.nii.gz
#PD${i}_T1_brain_mask.nii.gz
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/T1/T1/nii/ "${T1Dir}PD${i}_T1_brain.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/PD_${i}/exam_1/images/T1/T1/nii/ "${T1Dir}PD${i}_T1_brain_mask.nii.gz"
done
####### Healthy Control #############################
for i in "${input_K[@]}"
do
##1. Eddy Current Correction B0 of each patient & DTI of each patient.
cd /home/compimglab/Desktop/DTI/
eddy_correct K${i} /home/compimglab/Desktop/DTI/K${i}_ecc 0
cd /home/compimglab/Desktop/B0/
eddy_correct K${i}_B0 /home/compimglab/Desktop/B0/K${i}_B0_ecc 0
##2. Extract skull & spine for B0 of each patient.
cd /home/compimglab/Desktop/B0/
t=0.2
bet K${i}_B0_ecc K${i}_B0_ecc_brain -m -f $t -g 0
#2.1. Multiply DTI & B0_brain_mask of each patient.
fslmaths "${DTIDir}K${i}_ecc.nii.gz" -mul "${B0Dir}K${i}_B0_ecc_brain_mask.nii.gz" "${DTIDir}K${i}_ecc_brain.nii.gz"
cd /home/compimglab/Desktop/T1/
t1=0.5
bet "K${i}_T1" "K${i}_T1_brain" -m -f $t1 -g 0
#Upload Following Outputs to Server.
#K${i}_ecc.nii.gz
#K${i}_ecc.ecc.log
#K${i}_ecc_brain.nii.gz
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/DTI/DTI_32/nii/ "${DTIDir}K${i}_ecc.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/DTI/DTI_32/nii/ "${DTIDir}K${i}_ecc.ecclog"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/DTI/DTI_32/nii/ "${DTIDir}K${i}_ecc_brain.nii.gz"
#K${i}_B0_ecc.nii.gz
#K${i}_B0_ecc.ecc.log
#K${i}_B0_ecc_brain.nii.gz
#K${i}_B0_ecc_brain_mask.nii.gz
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}K${i}_B0_ecc.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}K${i}_B0_ecc.ecclog"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}K${i}_B0_ecc_brain.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/DTI/DTI_32/B0_DTI_32/nii/ "${B0Dir}K${i}_B0_ecc_brain_mask.nii.gz"
#K${i}_T1_brain.nii.gz
#K${i}_T1_brain_mask.nii.gz
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/T1/T1/nii/ "${T1Dir}K${i}_T1_brain.nii.gz"
ncftpput -u $USER -p $PASSWD $HOST /PD_Patients/K_${i}/exam_1/images/T1/T1/nii/ "${T1Dir}K${i}_T1_brain_mask.nii.gz"
done
####### END #############################
echo "Eddy Correction & BET has ended. Next Tensor Fitting will be executed."