-
Notifications
You must be signed in to change notification settings - Fork 0
/
OGREinstall.sh
executable file
·157 lines (134 loc) · 4.21 KB
/
OGREinstall.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
#!/usr/bin/env bash
#START240420
#REPO=/Users/mcavoy/repo/OGRE-pipeline/One-Step-General-Registration-and-Extraction-OGRE-pipline
root0=${0##*/}
helpmsg(){
#echo "Required: ${root0} <OGRE directory> -v <version number>"
#echo " -i --install -install"
#echo " OGRE will be installed at this location as <install>/<version>."
#echo " An argument without an option is assumed to be the OGRE directory."
#START240420
echo "Required: ${root0} -r <repository directory> -v <version number>"
echo " -r --repo -repo --repository -repository"
echo " Repository directory. All code for the install will be pulled from this directory."
echo " -i --install -install"
echo " OGRE will be installed at this location as <install>/<version>. Default is the working directory."
echo " An argument without an option is assumed to be the install directory."
echo " -v --version -version"
echo " Version number."
echo " -h --help -help"
echo " Echo this help message."
exit
}
if((${#@}<1));then
helpmsg
exit
fi
echo $0 $@
#do not set install;unexpected
unset version repo
arg=("$@")
for((i=0;i<${#@};++i));do
#echo "i=$i ${arg[i]}"
case "${arg[i]}" in
#START240420
-r | --repo | -repo | --repository | -repository)
repo=${arg[((++i))]}
#echo "install=$install"
;;
-i | --install | -install)
install=${arg[((++i))]}
#echo "install=$install"
;;
-v | --version | --version)
version=${arg[((++i))]}
#echo "version=$version"
;;
-h | --help | -help)
helpmsg
exit
;;
*) unexpected+=(${arg[i]})
;;
esac
done
[ -n "${unexpected}" ] && install=(${unexpected[@]})
#if [ -z "${install}" ];then
# echo "install not set. Abort!"
# exit
#fi
#START240420
if [ -z "${version}" ];then
echo "-version not set. Abort!"
exit
fi
if [ -z "${repo}" ];then
echo "-repository not set. Abort!"
exit
fi
if [ -z "${install}" ];then
install=$PWD
if [[ "$install" == "$repo" ]];then
echo "You cannot install in the same location as your repository $repo Abort!"
exit
fi
fi
#echo "install=$install"
#echo "version=$version"
id=$install/$version
if [ -d "$id" ];then
#https://stackoverflow.com/questions/18544359/how-do-i-read-user-input-into-a-variable-in-bash
read -p "$id exists. Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
#read -p "$id exists. Continue? (Y/N): " confirm && [[ ${confirm^^} == 'YES' ]] || exit 1
rm -rf $id
fi
#mkdir -p $id
#START240420
mkdir -p $id/scripts
files=(OGREcleanSETUP.sh \
OGREfMRIpipeSETUP.py \
OGREstructpipeSETUP.sh \
OGREdcm2niix.sh \
pdf2scanlist.py)
#for i in ${files[@]};do
# cp -p $REPO/$i $id
#done
#START240420
for i in ${files[@]};do
cp -p $repo/scripts/$i $id/scripts
done
#mkdir -p $id/HCP/scripts
#START240420
mkdir -p $id/lib
files=(OGREAtlasRegistrationToMNI152_FLIRTandFNIRT.sh \
OGREBiasFieldCorrection_sqrtT1wXT1w.sh \
OGRECreateMyelinMaps.sh \
OGREDistortionCorrectionAndEPIToT1wReg_FLIRTBBRAndFreeSurferBBRbased.sh \
OGREFreeSurfer2CaretConvertAndRegisterNonlinear.sh \
OGREFreeSurferHiresPial.sh \
OGREFreeSurferHiresWhite.sh \
OGREFreeSurferPipeline.sh \
OGREFreeSurferPipelineBatch.sh \
OGREGenericfMRIVolumeProcessingPipeline.sh \
OGREGenericfMRIVolumeProcessingPipelineBatch.sh \
OGREIntensityNormalization.sh \
OGREMotionCorrection.sh \
OGREOneStepResampling.sh \
OGREPostFreeSurferPipeline.sh \
OGREPostFreeSurferPipelineBatch.sh \
OGREPreFreeSurferPipeline.sh \
OGREPreFreeSurferPipelineBatch.sh \
OGRESetUpHCPPipeline.sh \
OGRESmoothingProcess.sh \
OGRET1w_restore.sh \
OGRET2wToT1wReg.sh \
OGREmcflirt.sh \
OGREmakeregdir.sh)
#for i in ${files[@]};do
# cp -p $REPO/HCP/scripts/$i $id/HCP/scripts
#done
#START240420
for i in ${files[@]};do
cp -p $repo/lib/$i $id/lib
done
echo "Installation $id complete."