# Mac installation¶

## Requirements¶

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

Miniconda2 will ask you where to install it. Do not forget to copy the export PATH given at the end of the installation (just in case). If everything went fine, open a new terminal and type which pip, it should lead to your Miniconda2 path.

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-volume-* x x x
dwi-preprocessing-* x x
dwi-processing-* x x x
pet-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:

• 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.
• 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.

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


## Installation¶

To install Clinica, type the following commands:

cd clinica
pip install .


If everything went fine, type clinica: it should display a help describing the different categories of command line (see Interacting with Clinica for further explanations).

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 setup¶

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"

# 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');


Note

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

## Keeping up-to-date¶

cd <PATH_TO_YOUR_CLINICA>