Skip to content

Commit 9b2eca0

Browse files
shnizzedycookpa
andcommitted
⬆️ Add script to install specific version of ANTs
Modified from https://github.com/cookpa/antsInstallExample/blob/master/installANTs.sh Co-authored-by: Philip Cook <[email protected]>
1 parent 410226a commit 9b2eca0

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed

dev/docker_data/install_ants.sh

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#!/bin/bash
2+
3+
antsBuildInstructions="https://github.com/ANTsX/ANTs/wiki/Compiling-ANTs-on-Linux-and-Mac-OS"
4+
5+
echo "
6+
This script will download ANTs, build and install under the current directory.
7+
8+
Developer tools including compilers, git and cmake must be installed
9+
10+
If you encounter errors, please see the installation instructions at
11+
12+
$antsBuildInstructions
13+
"
14+
15+
if [ $# -ne 1 ]
16+
then
17+
echo "
18+
Takes one commandline argument, the version of ANTs to install.
19+
"
20+
exit 0
21+
fi
22+
23+
echo "
24+
Build will proceed in 5 seconds
25+
"
26+
27+
sleep 5
28+
29+
workingDir=${PWD}
30+
31+
# Clone the repo
32+
git clone https://github.com/ANTsX/ANTs.git
33+
34+
# If you want to build a particular release, do so here
35+
cd ANTs
36+
git checkout $1
37+
cd -
38+
39+
# Number of threads used by make
40+
buildThreads=4
41+
42+
# Where to build, should be an empty directory
43+
buildDir=${workingDir}/build
44+
installDir=${workingDir}/install
45+
46+
mkdir $buildDir $installDir
47+
48+
cd $buildDir
49+
50+
# USE_VTK must be turned on to build antsSurf
51+
cmake \
52+
-DCMAKE_INSTALL_PREFIX=$installDir \
53+
-DBUILD_SHARED_LIBS=OFF \
54+
-DUSE_VTK=OFF \
55+
-DSuperBuild_ANTS_USE_GIT_PROTOCOL=OFF \
56+
-DBUILD_TESTING=OFF \
57+
-DRUN_LONG_TESTS=OFF \
58+
-DRUN_SHORT_TESTS=OFF \
59+
${workingDir}/ANTs 2>&1 | tee cmake.log
60+
61+
if [[ $? -ne 0 ]]; then
62+
echo "ANTs SuperBuild configuration failed. Please review documentation at
63+
64+
$antsBuildInstructions
65+
66+
If opening an issue, please attach
67+
68+
${buildDir}/cmake.log
69+
${buildDir}/CMakeCache.txt
70+
${buildDir}/CMakeFiles/CMakeError.log
71+
${buildDir}/CMakeFiles/CMakeOutput.log
72+
73+
"
74+
exit 1
75+
fi
76+
77+
make -j $buildThreads 2>&1 | tee build.log
78+
79+
if [[ ! -f "CMakeFiles/ANTS-complete" ]]; then
80+
echo "ANTs compilation failed. Please review documentation at
81+
82+
$antsBuildInstructions
83+
84+
If opening an issue, please attach
85+
86+
${buildDir}/build.log
87+
${buildDir}/cmake.log
88+
${buildDir}/CMakeCache.txt
89+
${buildDir}/CMakeFiles/CMakeError.log
90+
${buildDir}/CMakeFiles/CMakeOutput.log
91+
92+
"
93+
exit 1
94+
fi
95+
96+
cd ANTS-build
97+
make install 2>&1 | tee install.log
98+
99+
antsRegExe="${installDir}/bin/antsRegistration"
100+
101+
if [[ ! -f ${antsRegExe} ]]; then
102+
echo "Installation failed. Please review documentation at
103+
104+
$antsBuildInstructions
105+
106+
If opening an issue, please attach
107+
108+
${buildDir}/build.log
109+
${buildDir}/cmake.log
110+
${buildDir}/CMakeCache.txt
111+
${buildDir}/ANTS-build/install.log
112+
${buildDir}/CMakeFiles/CMakeError.log
113+
${buildDir}/CMakeFiles/CMakeOutput.log
114+
115+
"
116+
exit 1
117+
fi
118+
119+
echo "Installation complete, running ${antsRegExe}"
120+
121+
${antsRegExe} --version
122+
123+
echo "
124+
Binaries and scripts are located in
125+
126+
$installDir
127+
128+
Please see post installation instructions at
129+
130+
$antsBuildInstructions
131+
132+
"

0 commit comments

Comments
 (0)