Mac installationLink

RequirementsLink

Clinica is written in Python, version 2.7, and its core mainly depends on the NiPype & Dipy frameworks. These two open-source Python projects aim to provide a uniform interface to existing neuroimaging software packages and facilitate interactions between them.

Minimal requirements:

Miniconda2 allows you to install, run, and update Python packages and their dependencies. To install it, open a new terminal and type the following commands:

curl https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -o /tmp/miniconda2-installer.sh
bash /tmp/miniconda2-installer.sh

Pipeline-specific interfaces: Not all the following dependencies are necessary to install and run Clinica. You may want to only install the software packages used by certain pipelines of Clinica. Pipelines' specific dependencies are listed below:

ANTS CAT12 Dcm2niix Dcm2nii FreeSurfer FSL ITK Matlab MRtrix3 PETPVC SPM
convert-*-to-bids x x x
t1-freesurfer x
t1-fsl x
t1-spm-* x x x
dwi-preprocessing-* x x
dwi-processing x x x
pet-preprocessing-volume x x* x x* x
statistics-surfstat x
machine-learning-svm-*

*You only need to install ITK if you plan to perform partial volume correction using PETPVC.

Please refer to each tool’s website for installation instructions:

  • ANTS Download here and follow the instructions on the ANTs wiki.
  • CAT12 Download the latest version here and follow the instructions to ensure that your cat12 folder is located in spm/toolbox.
  • dcm2niix Download here and follow the installation instructions on the same page.
  • dcm2nii Download here.
  • FreeSurfer Download here and follow the instructions on the FreeSurfer wiki.
  • FSL Download here and follow the instructions on the FSL wiki.
  • ITK Follow the instructions on the ITK blog.
  • Matlab
  • MRtrix3 Follow the instructions on the MRtrix website. The fastest solution is to use Homebrew: a brew tap MRtrix3/mrtrix3 followed by a brew install mrtrix3 will install MRtrix3.
  • SPM Download the latest version here and follow the instructions on the SPM wiki.
  • PETPVC Follow the instructions here. Do not forget to compile in RELEASE mode, otherwise, partial volume correction will be very slow.

Do not forget to check the installations following each tool’s guidelines.

DownloadLink

To download Clinica in the current directory, run the following command:

git clone https://gitlab.icm-institute.org/aramislab/clinica.git

InstallationLink

To install Clinica, type the following commands:

cd clinica
pip install .

Add the --user option to install Clinica in your local space without administration privileges. Do not forget to add ~/.local/bin to your PATH variable if you do so. Just paste this line in your ~/.bashrc (or ~/.bash_profile) :

export PATH="~/.local/bin:$PATH"

Finally, you will need to type only once activate-global-python-argcomplete --user in your terminal. This command will finish the installation of the argcomplete which ables to benefit from autocompletion when running Clinica with the command line.

Environment setupLink

Edit the file ~/.bashrc (or the configuration file associated to your shell. If you are using bash, it can also be ~/.bash_profile. If you are using zsh, it must be ~/.zshrc). Your file must look like as below. Please be careful if you copy/paste this, some adjustments are needed. You must specify on the corresponding lines: the path to your ANTs installation, your version of Matlab, the path to your SPM installation, the path to your MRtrix3 installation.

# System language setting:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

# Miniconda2 (should be added automatically):
export PATH="~/miniconda2/bin:$PATH"

# ANTs:
export ANTSPATH="/path/to/your/ANTs"
export PATH=${ANTSPATH}:${PATH}

# FreeSurfer:
export FREESURFER_HOME="/Applications/freesurfer"
source ${FREESURFER_HOME}/SetUpFreeSurfer.sh &> /dev/null

# FSL:
export FSLDIR="/usr/local/fsl"
export PATH="${FSLDIR}/bin":${PATH}
source ${FSLDIR}/etc/fslconf/fsl.sh

# Matlab (specify your version in the path):
export MATLAB_HOME="/Applications/MY_MATLAB_VERSION/bin/"
export PATH=${MATLAB_HOME}:${PATH}
export MATLABCMD="${MATLAB_HOME}/matlab"

# MRtrix:
export MRTRIX_HOME="/path/to/your/mrtrix3"
export PATH="${MRTRIX_HOME}/bin":"${MRTRIX_HOME}/scripts":${PATH}

# SPM:
export SPM_HOME="/path/to/your/spm12"

# Dcm2nii
export PATH="/path/to/your/dcm2nii:$PATH"

# Clinica:
#uncomment the following line if you have installed clinica using the ‘--user’ option
#export PATH=”~.local/bin:$PATH"
## Autocomplete system:
eval "$(register-python-argcomplete clinica)"

Note

zsh shell users will have to add this right before the last line:

autoload bashcompinit
bashcompinit

You must also add SPM to the MATLAB path variable if you installed it as a toolbox. To do so, add the following line to your startup.m file located in your initial working folder, by default ~/Documents/MATLAB (see here for more details). If the file does not exist, you can create it and type inside:

addpath('/path/to/your/spm12');

You can also replace the previous line by the following, assuming the SPM_HOME environment variable is set in your ~/.bashrc file.

[~, spmhome] = system('source ~/.bashrc > /dev/null; echo $SPM_HOME;');
spmhome = strsplit(spmhome,'\n');
addpath(spmhome{end-1});

Note

zsh shell users will have to replace ~/.bashrc by ~/.zshrc.

Keeping up-to-dateLink

To check and download Clinica updates, simply pull again the Clinica repository and re-install it:

cd <PATH_TO_YOUR_CLINICA>
git pull
pip uninstall clinica && pip install .