-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphantom-build
executable file
·98 lines (84 loc) · 3.83 KB
/
phantom-build
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
#!/bin/bash
####################################################################
#Configuration Set:
#--> Phantom simulation parameters
n=3 #Noise level [0,3,9] (default: 0)
rf=20 #RF field distortion [0,20,40] (default: 0)
GM_VALUE=80 #Gray Matter (ms) (default: 80)
WM_VALUE=112 #White Matter (ms) (default: 112)
CSF_VALUE=200 #CSF (ms) (default: 200)
R_TYPE=T2 #Type of relaxometry [T1,T2] (default: T2)
NUMBER_ECHOES=12 #Number of echos (default: 12)
TE=0.012 #Time of echo (seconds) (default: 0.012)
#
#--> If you want to change some parameters, please do this wisely
####################################################################
#n=${1:-$def_n}
# Check the softwares dependency
source scripts/dependency_check
OUTPUT_FOLDER=$1
#Check if the output folder selected exist
if [[ ! "`echo $OUTPUT_FOLDER`" == "" ]]; then
if [[ ! -e $OUTPUT_FOLDER ]]; then
echo "ERROR: The path for the output data do not exist!"
echo " Is it correct? $OUTPUT_FOLDER"
exit
fi
fi
if [[ "`echo $OUTPUT_FOLDER`" == "" ]]; then
echo "-- Starting phantom reconstruction --"
echo "#############################################"
echo "Configuration set:"
echo "Noise level = ${n}"
echo "RF field distortion = ${rf}"
echo "Gray Matter ${R_TYPE} = ${GM_VALUE}"
echo "White Matter ${R_TYPE} = ${WM_VALUE}"
echo "CSF Matter ${R_TYPE} = ${CSF_VALUE}"
echo "Number of echos = ${NUMBER_ECHOES}"
echo "Time of echo = ${TE}"
echo "Output folder = relaxophantom/relaxo/"
echo "#############################################"
echo "Step 1: Volumes segmentation"
./scripts/phantom_segmentation $n $rf $R_TYPE
echo "*** Step 1: Done ***"
echo "Step 2: Phantom reconstruction"
./scripts/phantom_recon $n $rf $GM_VALUE $WM_VALUE $CSF_VALUE $R_TYPE $NUMBER_ECHOES $TE
echo "*** Step 2: Done ***"
echo "Step 3: Reformating relaxometry volumes"
./scripts/phantom_reformat ${n} ${rf} ${NUMBER_ECHOES} ${R_TYPE} ${TE}
echo "*** Step 3: Done ***"
# Removing empty relaxometry image Volumes
for (( vol=153; vol<=180; vol++)); do
rm `ls ${PWD}/relaxo/*0${vol}*`
done
echo "The results are located in the folder ./relaxo"
else
echo "-- Starting phantom reconstruction --"
echo "#############################################"
echo "Configuration set:"
echo "Noise level = ${n}"
echo "RF field distortion = ${rf}"
echo "Gray Matter ${R_TYPE} = ${GM_VALUE}"
echo "White Matter ${R_TYPE} = ${WM_VALUE}"
echo "CSF Matter ${R_TYPE} = ${CSF_VALUE}"
echo "Number of echos = ${NUMBER_ECHOES}"
echo "Time of echo = ${TE}"
echo "Output folder = $OUTPUT_FOLDER"
echo "#############################################"
echo "Step 1: Volumes segmentation"
./scripts/phantom_segmentation $n $rf $R_TYPE
echo "*** Step 1: Done ***"
echo "Step 2: Phantom reconstruction"
./scripts/phantom_recon $n $rf $GM_VALUE $WM_VALUE $CSF_VALUE $R_TYPE $NUMBER_ECHOES $TE
echo "*** Step 2: Done ***"
echo "Step 3: Reformating relaxometry volumes"
./scripts/phantom_reformat ${n} ${rf} ${NUMBER_ECHOES} ${R_TYPE} ${TE}
echo "*** Step 3: Done ***"
#Changing output folder
mv relaxo/ $OUTPUT_FOLDER
# Removing empty relaxometry image Volumes
for (( vol=153; vol<=180; vol++)); do
rm `ls $OUTPUT_FOLDER/relaxo/*0${vol}*`
done
echo "The results are located in the folder $OUTPUT_FOLDER"
fi