1.检查gcc和cmake,若无则要安装
sudo apt-get install cmake-curses-gui
2.安装ITK,官网下载安装包
3.安装ZLIB
sudo apt-get install zlib1g-dev
4.安装ANTS
workingDir=${PWD}
git clone https://github.com/ANTsX/ANTs.git
mkdir build install
cd build
cmake \
-DCMAKE_INSTALL_PREFIX=${workingDir}/install \
../ANTs 2>&1 | tee cmake.log
make -j 4 2>&1 | tee build.log
cd ANTS-build
make install 2>&1 | tee install.log
Compiling ANTs on Linux and Mac OS · ANTsX/ANTs Wiki · GitHub
医学图像配准软件 ANTs(Advanced Normalization Tools)的安装和使用说明 - 灰信网(软件开发博客聚合)
5.验证
antsRegistrationSyN.sh
6.使用
antsRegistrationSyN.sh -d 3 -f mri.nii.gz -m pet.nii.gz -t 'r' -o output
大约2-3分钟
脚本批量处理
#!/usr/bin/bash
mri_path=/home/hannah/data/PETMR/HENAN/brain_mri/
pet_path=/home/hannah/data/PETMR/HENAN/raw_pet_nii
out_path=/home/hannah/data/PETMR/HENAN/pet/
declare -i num=0
#brain=/mri/brain.mgz
#mri=/mri/T1.mgz
for pet_file in $pet_path/*
do
num=num+1
#let num=${num}+1
mri_file=${mri_path}"brain_"$num".nii.gz"
out_file=${out_path}$num
#echo ${pet_file}, ${mri_file}, ${out_file}
antsRegistrationSyN.sh -d 3 -f ${mri_file} -m ${pet_file} -t 'r' -o ${out_file}
done
echo $num