# Third-party software¶

## Converters¶

If you want to run the convert-*-to-bids commands (e.g. convert-adni-to-bids), you will need to install the dcm2niix, dcm2nii and FreeSurfer software.

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

• FreeSurfer
• For Linux users, download and install FreeSurfer following the instructions on the wiki. Please note that on Ubuntu you will need to install the packages tcsh and libjpeg62 (a sudo apt-get install tcsh libjpeg62 should do the job).

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

## 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 FreeSurfer FSL ITK Matlab MRtrix3 NODDI Matlab Toolbox PETPVC SPM
t1-freesurfer x
t1-volume-* x x x
dwi-preprocessing-* x x
dwi-processing-dti x x x
dwi-processing-noddi x x x
fmri-preprocessing x x x
pet-surface x x* x* x
pet-volume x x* x x* x
statistics-surface x
machine-learning-svm-*

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

Depending on the architecture and OS of your system, setup of third party libraries can change. Please refer to each tool’s website for installation instructions:

• FreeSurfer
• For Linux users, download and install FreeSurfer following the instructions on the wiki. Please note that on Ubuntu you will need to install the packages tcsh and libjpeg62 ( a sudo apt-get install tcsh libjpeg62 should do the job).
• MRtrix3 Follow the instructions on the MRtrix website (this page for Linux users and this page for Mac users). Note for Mac users: the fastest solution is to use Homebrew; a brew tap MRtrix3/mrtrix3 followed by a brew install mrtrix3 will install MRtrix3.
• Matlab
• 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.

## Environment variables 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 different installations.

Regarding the NODDI Matlab Toolbox

In order to use the interaction between the NODDI Matlab Toolbox and Clinica, we defined the NODDI_MATLAB_TOOLBOX environment variable as well as the NIFTI_MATLAB_TOOLBOX environment variable (niftimatlib is a dependency of NODDI Matlab Toolbox)

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

# Miniconda (should be added automatically)
export PATH="~/miniconda3/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
# Uncomment the line below if you are on Mac:
#export FSLDIR="/usr/local/fsl"
# Uncomment the line below if you are on Linux:
#export FSLDIR="/usr/share/fsl/5.0"
export PATH="${FSLDIR}/bin":${PATH}
source ${FSLDIR}/etc/fslconf/fsl.sh # Matlab export MATLAB_HOME="/path/to/your/matlab/bin/" export PATH=${MATLAB_HOME}:${PATH} export MATLABCMD="${MATLAB_HOME}/matlab"

# MRtrix3
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 source ~/.bash_completion.d/python-argcomplete.sh  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');

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