ANTs安装

医学配准软件ANTs安装Tutorial+避坑指南
官网编译源码教程

#!/bin/bash

antsBuildInstructions="https://github.com/ANTsX/ANTs/wiki/Compiling-ANTs-on-Linux-and-Mac-OS"

echo "
This script will download ANTs, build and install under the current directory. 
Developer tools including compilers, git and cmake must be installed
If you encounter errors, please see the installation instructions at
  $antsBuildInstructions
Build will proceed in 5 seconds
"

sleep 5

workingDir=${PWD}

# Clone the repo
git clone https://github.com/ANTsX/ANTs.git

# If you want to build a particular release, do so here
# cd ANTs
# git checkout v2.3.1
# cd -

# Number of threads used by make
buildThreads=4

# Where to build, should be an empty directory
buildDir=${workingDir}/build
installDir=${workingDir}/install

mkdir $buildDir $installDir

cd $buildDir

# USE_VTK must be turned on to build antsSurf
cmake \
    -DCMAKE_INSTALL_PREFIX=$installDir \
    -DBUILD_SHARED_LIBS=OFF \
    -DUSE_VTK=OFF \
    -DBUILD_TESTING=OFF \
    -DRUN_LONG_TESTS=OFF \
    -DRUN_SHORT_TESTS=OFF \
    ${workingDir}/ANTs 2>&1 | tee cmake.log

if [[ $? -ne 0 ]]; then
  echo "ANTs SuperBuild configuration failed. Please review documentation at
    $antsBuildInstructions
  If opening an issue, please attach
  
  ${buildDir}/cmake.log
  ${buildDir}/CMakeCache.txt
  ${buildDir}/CMakeFiles/CMakeError.log
  ${buildDir}/CMakeFiles/CMakeOutput.log
  
"
  exit 1 
fi

make -j $buildThreads 2>&1 | tee build.log

if [[ ! -f "CMakeFiles/ANTS-complete" ]]; then
  echo "ANTs compilation failed. Please review documentation at
    $antsBuildInstructions
  If opening an issue, please attach
  ${buildDir}/build.log
  ${buildDir}/cmake.log
  ${buildDir}/CMakeCache.txt
  ${buildDir}/CMakeFiles/CMakeError.log
  ${buildDir}/CMakeFiles/CMakeOutput.log
  
"
  exit 1
fi

cd ANTS-build
make install 2>&1 | tee install.log

antsRegExe="${installDir}/bin/antsRegistration"

if [[ ! -f ${antsRegExe} ]]; then
  echo "Installation failed. Please review documentation at
    $antsBuildInstructions
  If opening an issue, please attach
  ${buildDir}/build.log
  ${buildDir}/cmake.log
  ${buildDir}/CMakeCache.txt
  ${buildDir}/ANTS-build/install.log
  ${buildDir}/CMakeFiles/CMakeError.log
  ${buildDir}/CMakeFiles/CMakeOutput.log
"
  exit 1
fi

echo "Installation complete, running ${antsRegExe}"

${antsRegExe} --version

echo "
Binaries and scripts are located in 
  $installDir
Please see post installation instructions at 
  $antsBuildInstructions
"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值