作为一个医学图像研究僧,怎么能不会各种医学图像处理软件的安装,今天记录一下这些软件的安装过程,很简单。这些软件包括spm,FSL,freesurfer等。
1. FSL
1.1 安装
去官网注册一下,并下载fslinstall.py文件,:https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/Linux
安装命令:
python fslinstaller.py
其中可以选择参数:
-d specify folder to install FSL into (without ‘fsl’), e.g. /usr/local
-e only configure your account for running FSL
-E configure FSL for all users (Linux)
-v print installer version number and exit
-c check for updated versions of FSL
-l list versions of FSL available for download
-V install specified version number e.g. 5.0.10
-s download the source code for the current, or specified version of FSL
-F download the FEEDS data set for the current, or specified version of FSL
-q silence all messages
-p skip environment setup
-D switch on debug messages - use this option to generate logging that can be included when requesting installation support
需要注意的是: -l 可以看可以安装的版本,-V指定版本, -d指定路径,路径需要有可写入权限。
需要很长的时间等待,完成之后添加环境变量。
vim ~/.bashrc
添加:
# FSL
export FSLDIR=/usr/local/fsl
. ${FSLDIR}/etc/fslconf/fsl.sh
export PATH=$PATH:$FSLDIR/bin
重新登录或者source一下生效。
1.2 验证
FSL依赖python版本为Python2,一定要将系统的默认版本设置为python2
flirt -version
如果安装成功:
FLIRT version 6.0
可能会报错:
libopenblas.so.0: cannot open shared object file: No such file or directory
1.3 错误解决
安装openblas就可以解决1.2 中的错误
下载地址: https://github.com/xianyi/OpenBLAS/releases
下载后解压:
tar -zxvf OpenBLAS*
进入目录后:
sudo make PREFIX=/usr/local/blas
sudo make install
在lib64里建立软连接:
sudo ln -s /usr/local/blas/libopenblas_haswellp-r0.2.20.so /usr/lib64/libopenblas.so.0
之后就可以了
2. Freesurfer
2.1 安装
安装包下载地址:http://www.freesurfer.net/fswiki/DownloadAndInstall
安装命令:
tar -C /usr/local -xzvf freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz
-C后面是安装位置
2.2 添加环境变量
vim ~/.bashrc
添加:
# freesurfer
export FREESURFER_HOME=/usr/local/freesurfer
FS_FREESURFERENV_NO_OUTPUT=1
source $FREESURFER_HOME/SetUpFreeSurfer.sh
第二句是为了设置每次登陆的时候不输出freesurfer的环境变量。
2.3 安装响应的库文件
ldd /usr/local/freesurfer/tktools/tksurfer.bin
缺什么,,补什么。亲测图中没有的三个不是必须的。
2.4 报错处理
- libGLU找不到
错误信息:/usr/local/freesurfer/tktools/tkregister2.bin: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory
解决办法:安装一下libGLU
# yum whatprovides libGLU.so.1
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
- base: repos-va.psychz.net
- epel: mirrors.mit.edu
- extras: mirrors.rit.edu
- updates: mirror.wdc1.us.leaseweb.net
mesa-libGLU-9.0.0-4.el7.i686 : Mesa libGLU library
Repo : base
Matched from:
Provides : libGLU.so.1
yum install mesa-libGLU-9.0.0-4.el7.i686
建立连接一下:
sudo ln -s /usr/lib/libGLU.so.1 /usr/bin/libGLU.so.1
- libnetcdf.so.6找不到
解决办法:
yum install netcdf
装完要链接一下到cdf6.0
ln -s /usr/lib64/libnetcdf.so.7 /usr/bin/libnetcdf.so.6
- error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
解决办法:sudo yum install libXScrnSaver
3. AFNI
3.1 安装
centos7版本下载:
wget https://afni.nimh.nih.gov/pub/dist/tgz/linux_centos_7_64.tgz
其他版本下载:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/download_links.html
下载后解压到安装目录,并添加环境变量:
tar -zxvf inux_centos_7_64.tgz
复制文件到安装位置
cd inux_centos_7_64
sudo cp -r * /usr/local/afni
vim ~/.bashrc:
# AFNI
export AFNI_DIR=/usr/local/afni
export PATH=$PATH:$AFNI_DIR
3.2 验证
重新加载环境变量后输入:afni
界面很不好看啊
3.3 报错信息
- 错误代码
afni: error while loading shared libraries: libXm.so.4: cannot open shared object file: No such file or directory
- 解决方案
sudo yum install libXp
sudo yum install openmotif