├── figs4readme └── terminal.png ├── old ├── osx_uzleuven_clean.sh ├── osx_uzleuven_install.sh └── KUL_Install_NeuroImagingSoftware.sh ├── README.md └── KUL_Install_NeuroImagingSoftware.sh /figs4readme/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treanus/KUL_Linux_Installation/HEAD/figs4readme/terminal.png -------------------------------------------------------------------------------- /old/osx_uzleuven_clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Clean on OsX machine 4 | 5 | # remove bash_profile 6 | cd 7 | mv $HOME/.bash_profile $HOME/bash_profile_backup 8 | 9 | # remove anaconda 10 | rm -rf $HOME/opt/anaconda3 11 | rm -rf $HOME/anaconda3 12 | 13 | # remove brew 14 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Here's how to install Neuroimaging Software on Linux, WSL2 and macOS. 2 | 3 | This script installs a large number of NeuroImaging related software on Linux (I prefer Linux Mint 21.1, but Ubuntu 22.04 also works). 4 | It is not maintained anymore to install on Windows-WSL2 (latest Win11 preferably) or macOS. Results may vary... 5 | 6 | It is assumed you have an nvidia gpu. 7 | 8 | ## Which NeuroImaging software 9 | 10 | The script installs the latest stable versions of: 11 | - Anaconda3 12 | - Video Studio Code 13 | - nvidia cuda 14 | - mrtrix3 15 | - FSL 16 | - Docker 17 | - Freesurfer 18 | - ANTs 19 | - dcm2niix 20 | - dcm2bids 21 | - DCMTK 22 | - GDCM 23 | - SPM12 24 | - cat12 25 | - lead-DBS 26 | - conn toolbox 27 | - KUL_NeuroImaging_tools 28 | - KUL_VBG 29 | - KUL_FWT 30 | - Mevislab 31 | - Scilpy (in the conda environment "scilpy") 32 | - FastSurfer (in the conda environment "fastsurfer_gpu") 33 | - Karawun (in the conda environment "KarawunEnv") 34 | 35 | ## Output of a terminal after installation 36 | 37 | The terminal in WSL2, macOS and Linux will show which version of software is currently installed. 38 | 39 | ![Terminal output](figs4readme/terminal.png) 40 | 41 | ## Prerequisites 42 | 43 | ### All (but optional) 44 | - Matlab (R2017b or later) - only needed if you use spm12, conn, cat12, lead-dbs 45 | 46 | ### Linux 47 | - Should run out of the box. 48 | - follow the instructions given by the installer 49 | 50 | ### Windows with WSL2 51 | - Install win11, perform all updates 52 | - Install nvidia-cuda: follow https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl 53 | - Open powershell as administrator and exe: wsl --install 54 | - reboot when asked 55 | - after reboot you will be asked to setup the user/passwd 56 | - INSIDE WIN11: install 57 | - visual studio code 58 | - docker desktop & setup the ubuntu as wsl integration 59 | - open Ubuntu in wsl2 60 | - follow the instructions given by the installer 61 | 62 | ### macOS 63 | - Should work out of the box 64 | - follow the instructions given by the installer 65 | 66 | 67 | ## Installation notes 68 | 69 | Open a terminal. 70 | Copy the following commands into terminal. 71 | 72 | 73 | wget https://raw.githubusercontent.com/treanus/KUL_Linux_Installation/master/KUL_Install_NeuroImagingSoftware.sh 74 | 75 | chmod +x KUL_Install_NeuroImagingSoftware.sh 76 | 77 | 78 | Now run the script 79 | 80 | ./KUL_Install_NeuroImagingSoftware.sh 81 | 82 | In a first step this will install Anaconda3. 83 | Follow the installation instruction, and accept the license and initialization. 84 | Reboot when asked. 85 | 86 | Rerun the script. 87 | 88 | ./KUL_Install_NeuroImagingSoftware.sh 89 | 90 | Depending on the cpu and the internet connection speed this will take a few hours. 91 | 92 | On some occasions you will be asked to enter your password and/or to confirm the installation. 93 | 94 | 95 | ## Post-Install 96 | 97 | - The freesurfer license file needs to be installed. Put it in $KUL_apps_DIR/freesurfer_license 98 | - Start matlab, add spm12 and conn to the path. The path for spm12 and conn is $HOME/KUL_apps/spm and conn. 99 | - On macOS open Docker Desktop; in Resources/FileSharing add the folder with the freesurfer license. 100 | -------------------------------------------------------------------------------- /old/osx_uzleuven_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # This script installs many NeuroImaging software for use in MRI neuroimaging... 4 | # Stefan Sunaert - first version dd 08092020 - v0.1 5 | # current version dd 19102021 - v0.5 6 | 7 | # Define the install location 8 | install_location=/usr/local/KUL_apps 9 | KUL_apps_config="${install_location}/KUL_apps_config" 10 | bashpoint=".bash_profile" 11 | 12 | # First define a function to keep installation of things tidy 13 | function install_KUL_apps { 14 | cd ${install_location} 15 | echo -e "\n\n\n" 16 | read -r -p "Proceed with the installation of $1? [y/n] " prompt 17 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] 18 | then 19 | echo 'OK we continue' 20 | else 21 | exit 22 | fi 23 | } 24 | 25 | # Give some information & ask permission to continue 26 | echo 'This script will install a lot of neuro-imaging software on a OsX system' 27 | echo ' for details see https://github.com/treanus/KUL_Linux_Installation' 28 | echo ' it will take several hours to install (and compile, if needed) all software. ' 29 | echo ' You may have to reboot once, after which you have to restart the script.' 30 | echo ' The script will check what has already been installed and continue installing software' 31 | echo ' This script may ask you a several times for your password in order to install software (sudo usage)' 32 | 33 | read -r -p "Proceed with the installation? [y/n] " prompt 34 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] 35 | then 36 | echo 'OK we continue' 37 | else 38 | exit 39 | fi 40 | 41 | # Now make the install directory 42 | # Determine group id 43 | kul_group=$(id -g) 44 | #echo $kul_group 45 | sudo mkdir -p ${install_location} 46 | sudo chgrp -R ${kul_group} ${install_location} 47 | sudo chmod -R 770 ${install_location} 48 | 49 | # initiate the config file to be sourced by .bash_profile 50 | if [ ! -f ${KUL_apps_config} ]; then 51 | echo "export KUL_apps_DIR=${install_location}" > ${KUL_apps_config} 52 | echo "# Welcome to KUL_Apps" >> ${KUL_apps_config} 53 | echo "echo \" installation DIR is ${install_location}\" " >> ${KUL_apps_config} 54 | echo "echo \" the config file is ${KUL_apps_config}\" " >> ${KUL_apps_config} 55 | echo "echo \" \" " >> ${KUL_apps_config} 56 | echo "" >> ${bashpoint} 57 | echo "# Source the KUL_apps and other neuroimaging software" >> ${bashpoint} 58 | echo "source ${KUL_apps_config}" >> ${bashpoint} 59 | echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ${bashpoint} 60 | fi 61 | 62 | # Installation of Anaconda & welcome 63 | if ! command -v conda &> /dev/null 64 | then 65 | install_KUL_apps "Anaconda3" 66 | anaconda_version=Anaconda3-2021.05-MacOSX-x86_64.pkg 67 | curl -o ${anaconda_version} https://repo.anaconda.com/archive/${anaconda_version} 68 | sudo installer -pkg ${anaconda_version} -target ${install_location} 69 | rm -fr ${anaconda_version} 70 | echo -e "\n\n\n" 71 | echo 'Now exit this terminal and run the KNT_Linux_install.sh again from a new terminal' 72 | exit 73 | else 74 | echo 'Already installed Anaconda3' 75 | fi 76 | 77 | 78 | # Install command line developer tools 79 | if xcode-select --install 2>&1 | grep installed; then 80 | echo "Already installed command line developer tools" 81 | else 82 | echo "Installing command line developer tools" 83 | xcode-select --install 84 | fi 85 | 86 | # Installation of HD-BET 87 | if ! command -v hd-bet &> /dev/null 88 | then 89 | install_KUL_apps "HD-BET" 90 | git clone https://github.com/MIC-DKFZ/HD-BET 91 | cd HD-BET 92 | sudo pip install -e . 93 | cd 94 | echo "" >> ${KUL_apps_config} 95 | echo "# Setting up HD-BET" >> ${KUL_apps_config} 96 | echo "alias hd-bet='hd-bet -device cpu -mode fast -tta 0 ' " >> ${KUL_apps_config} 97 | else 98 | echo 'Already installed HD-BET' 99 | fi 100 | 101 | # Installation of MRtrix3 102 | if ! command -v mrconvert &> /dev/null 103 | then 104 | install_KUL_apps "MRtrix3" 105 | sudo conda install -c mrtrix3 mrtrix3 106 | else 107 | echo 'Already installed MRtrix3' 108 | fi 109 | 110 | # download a number of Docker containers 111 | echo -e "\n\n\n" 112 | echo "We are going to download a number of docker containers..." 113 | echo "Start docker desktop and wait until it is running..." 114 | read -p "Press any key to continue... " -n1 -s 115 | #docker pull jenspetersen/hd-glio-auto 116 | echo "Installing synb0" 117 | docker pull hansencb/synb0 118 | 119 | # Installation of FSL 120 | if ! [ -d "/usr/local/fsl" ] 121 | then 122 | install_KUL_apps "FSL" 123 | curl -o XQuartz-2.8.1.dmg https://github.com/XQuartz/XQuartz/releases/download/XQuartz-2.8.1/XQuartz-2.8.1.dmg 124 | sudo installer -pkg XQuartz-2.8.1.dmg 125 | curl -o fslinstaller.py https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py 126 | echo -e "\n\n\n" 127 | echo "Here we give the installation instructions for FSL..." 128 | echo "it is ok to install to the default /usr/local/fsl directory" 129 | echo "You need to have QXartz installed, see https://www.xquartz.org/" 130 | echo "install this first before continuing" 131 | read -p "Press any key to continue... " -n1 -s 132 | python2.7 fslinstaller.py 133 | rm fslinstaller.py 134 | exit 135 | cat <> ${KUL_apps_config} 136 | # Installing FSL 137 | FSLDIR=/usr/local/fsl 138 | . \${FSLDIR}/etc/fslconf/fsl.sh 139 | PATH=\${FSLDIR}/bin:\${PATH} 140 | export FSLDIR PATH 141 | EOT 142 | 143 | else 144 | echo 'Already installed FSL' 145 | fi 146 | 147 | exit 148 | 149 | echo -e "\n\n\n" 150 | echo "Here we give the installation instructions for FSL..." 151 | echo "it is ok to install to the default /usr/local/fsl directory" 152 | read -p "Press any key to continue... " -n1 -s 153 | 154 | # Check for Homebrew, install if we don't have it 155 | if test ! $(which brew); then 156 | echo "Installing homebrew..." 157 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 158 | fi 159 | 160 | # setup Brew for multiple users 161 | sudo chgrp -R admin /usr/local/* 162 | sudo chmod -R g+w /usr/local/* 163 | 164 | # allow admins to homebrew's local cache of formulae and source files 165 | sudo chgrp -R admin /Library/Caches/Homebrew 166 | sudo chmod -R g+w /Library/Caches/Homebrew 167 | 168 | # if you are using cask then allow admins to manager cask install too 169 | sudo chgrp -R admin /opt/homebrew-cask 170 | sudo chmod -R g+w /opt/homebrew-cask 171 | 172 | 173 | # Update homebrew recipes 174 | brew update 175 | 176 | PACKAGES=( 177 | git 178 | hub 179 | jq 180 | wget 181 | parallel 182 | eigen 183 | qt5 184 | pkg-config 185 | libtiff 186 | fftw 187 | mmv 188 | cmake 189 | netpbm 190 | ) 191 | echo "Installing packages..." 192 | brew install ${PACKAGES[@]} 193 | 194 | 195 | # Installing casks & fonts 196 | # brew install caskroom/cask/brew-cask 197 | 198 | CASKS=( 199 | cyberduck 200 | docker 201 | firefox 202 | google-chrome 203 | slack 204 | yujitach-menumeters 205 | osirix-quicklook 206 | quicklook-json 207 | quicklook-csv 208 | dropbox 209 | ) 210 | 211 | echo "Installing cask apps..." 212 | brew cask install ${CASKS[@]} 213 | 214 | echo "Installing fonts..." 215 | brew tap caskroom/fonts 216 | FONTS=( 217 | caskroom/fonts/font-montserrat 218 | ) 219 | brew cask install ${FONTS[@]} 220 | 221 | 222 | # Create bash_profile 223 | touch ~/.bash_profile 224 | 225 | # Modify git to work from behind the firewall 226 | git config --global url."https://".insteadOf git:// 227 | 228 | 229 | # This adds qt binaries to your path 230 | echo 'export PATH=`brew --prefix`/opt/qt5/bin:$PATH' >> ~/.bash_profile 231 | 232 | 233 | # Install XQuartz 2.7.11 234 | wget https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.11.dmg -P ~/Downloads/ 235 | hdiutil attach ~/Downloads/XQuartz-2.7.11.dmg 236 | cp -rf /Volumes/XQuartz-2.7.11/XQuartz.pkg /Applications/ 237 | sudo installer -pkg /Applications/XQuartz.pkg -target / 238 | rm /Applications/XQuartz.pkg 239 | diskutil unmount /Volumes/XQuartz-2.7.11/ 240 | 241 | 242 | # Add your Mac distro Python 2.7 to path 243 | #echo '# add python 2.7 to path' >> ~/.bash_profile 244 | #echo 'export PATH="/usr/bin:$PATH"' >> ~/.bash_profile 245 | 246 | 247 | # Create the KUL_apps folder 248 | sudo mkdir /KUL_apps 249 | sudo chgrp -R admin /KUL_apps 250 | sudo chmod -R g+w /KUL_apps 251 | 252 | 253 | # Install FSL 254 | echo "Checking whether FSL is already installed" 255 | source ~/.bash_profile 256 | if test ! $(which fsleyes); then 257 | echo "FSL isn't installed so we will download FSL installer and run it, you will need to enter your admin password" 258 | curl -o ~/Downloads/fslinstaller.py https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py 259 | sudo python2.7 ~/Downloads/fslinstaller.py -d /KUL_apps/fsl 260 | fi 261 | 262 | # Install ANTs 263 | sudo chown `whoami` .bash_profile 264 | echo "Copying ANTs from the Linux server and adding it to your path" 265 | sudo scp -r administrator@thibo:/KUL_sources/ants /KUL_apps 266 | echo ' ' >> ~/.bash_profile 267 | echo '# adding ANTS to your path' >> ~/.bash_profile 268 | echo 'ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=4' >> ~/.bash_profile 269 | echo 'export ANTSPATH=/KUL_apps/ants/bin' >> ~/.bash_profile 270 | echo 'export PATH=${ANTSPATH}:$PATH' >> ~/.bash_profile 271 | 272 | 273 | # Install MRTRIX3 274 | echo "Installing/Checking MRtrix3..." 275 | if test ! $(which mrview); then 276 | git clone https://github.com/MRtrix3/mrtrix3.git /KUL_apps/mrtrix3 277 | cd /KUL_apps/mrtrix3 278 | ./configure 279 | ./build 280 | ./set_path 281 | fi 282 | 283 | echo "Cleaning up..." 284 | brew cleanup 285 | 286 | # Install freesurfer 287 | mkdir /KUL_apps/freesurfer 288 | mkdir /KUL_apps/freesurfer_install 289 | wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.0/freesurfer-Darwin-OSX-stable-pub-v6.0.0.dmg -P /KUL_apps/freesurfer_install 290 | hdiutil attach /KUL_apps/freesurfer_install/freesurfer-Darwin-OSX-stable-pub-v6.0.0.dmg 291 | # mounting the dmg and installing, fixed path typos 292 | sudo installer -pkg /Volumes/freesurfer-Darwin-full/freesurfer-Darwin-full.pkg -target / 293 | sudo mv /Applications/freesurfer /KUL_apps/ 294 | echo "get your freesurfer license from here https://surfer.nmr.mgh.harvard.edu/registration.html" 295 | echo "use this command to get the license in the freesurfer folder" 296 | echo "cp ~/Downloads/license.txt /KUL_apps/freesurfer" 297 | echo '# Adding freesurfer to your path' >> ~/.bash_profile 298 | echo 'export FREESURFER_HOME=/KUL_apps/freesurfer' >> ~/.bash_profile 299 | echo 'source $FREESURFER_HOME/SetUpFreeSurfer.sh' >> ~/.bash_profile 300 | 301 | # Rename your .bash_profile to .bashrc and source .bashrc from .bash_profile 302 | mv ~/.bash_profile ~/.bashrc 303 | touch ~/.bash_profile 304 | echo '[ -r ~/.bashrc ] && . ~/.bashrc' >> ~/.bash_profile 305 | echo 'export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace' >> ~/.bashrc 306 | 307 | # Install AFNI 308 | # Following the instructions on https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_mac.html#what-to-do 309 | defaults write org.macosforge.xquartz.X11 wm_ffm -bool true 310 | defaults write org.x.X11 wm_ffm -bool true 311 | defaults write com.apple.Terminal FocusFollowsMouse -string YES 312 | touch ~/.cshrc 313 | echo 'setenv DYLD_LIBRARY_PATH /opt/X11/lib/flat_namespace' >> ~/.cshrc 314 | mkdir /KUL_apps/AFNI_source 315 | curl -o /KUL_apps/AFNI_source/@update.afni.binaries -O https://afni.nimh.nih.gov/pub/dist/bin/macosx_10.7_local/@update.afni.binaries 316 | tcsh /KUL_apps/AFNI_source/@update.afni.binaries -bindir /KUL_apps/AFNI -package macos_10.12_local 317 | # We're instructed to reboot after this line then continue with the rest 318 | # need to move install directory to KUL_apps 319 | #touch $reboot_marker # to create a file to look for upon reboot and continue with the rest of the script 320 | #sudo reboot 321 | echo 'export PATH=$PATH:/KUL_apps/AFNI' >> ~/.bashrc 322 | echo 'export DYLD_FALLBACK_LIBRARY_PATH=/KUL_apps/AFNI' >> ~/.bashrc 323 | wget https://cran.r-project.org/bin/macosx/el-capitan/base/R-3.4.1.pkg -P ~/Downloads/ 324 | sudo installer -pkg ~/Downloads/R-3.4.1.pkg -target / 325 | sudo rPkgsInstall -pkgs ALL 326 | cp /KUL_apps/AFNI/FNI.afnirc $HOME/.afnirc 327 | suma -update_env 328 | 329 | 330 | #echo "Installing global npm packages..." 331 | #npm install particle-cli -g 332 | 333 | # Install Horos 334 | wget https://horosproject.org/horos-content/Horos3.2.1.dmg -P ~/Downloads/ 335 | hdiutil attach ~/Downloads/Horos3.2.1.dmg 336 | cp -rf /Volumes/Horos/Horos.app /Applications/ 337 | 338 | # Install dcm2niix 339 | sudo scp -r administrator@thibo:/KUL_sources/MRIcroGL /KUL_apps/ 340 | echo '# Add MRIcroGL to path' >> ~/.bashrc 341 | echo 'export PATH=$PATH:/KUL_apps/MRIcroGL' >> ~/.bashrc 342 | 343 | # Install dcm2bids 344 | git clone https://github.com/jooh/Dcm2Bids.git /KUL_apps/Dcm2Bids 345 | echo 'export PATH=$PATH:/KUL_apps/Dcm2Bids/scripts' >> ~/.bashrc 346 | pip install msgpack --user 347 | pip install future --user 348 | pip install dcm2bids /KUL_apps/Dcm2Bids/ --user 349 | 350 | source ~/.bash_profile 351 | dcm2niix -u 352 | 353 | # Installing adobe reader 354 | VERSION="1501020056" 355 | FILE="AcroRdrDC_${VERSION}_MUI.dmg" 356 | URL="http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/${VERSION}/${FILE}" 357 | 358 | curl -O "$URL"; 359 | 360 | MOUNT_POINT=$(hdiutil attach $FILE | tail -1 | awk '{print $3;}'); 361 | PKG_FILE=$(ls -1 $MOUNT_POINT | tail -1) 362 | PKG_PATH=$(printf "%s/%s" $MOUNT_POINT $PKG_FILE) 363 | 364 | sudo installer -allowUntrusted -pkg $PKG_PATH -target / 365 | 366 | hdiutil detach $MOUNT_POINT 367 | rm $FILE 368 | 369 | echo "Bootstrapping complete" 370 | 371 | echo "Keeping up to date" 372 | echo "You're all set, don't forget to install Matlab and any other programs you might need :) " 373 | 374 | -------------------------------------------------------------------------------- /KUL_Install_NeuroImagingSoftware.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script installs many NeuroImaging software for use in 4 | # MRI neuroimaging on Linux, WSL2 or macOS... 5 | # Stefan Sunaert - first version dd 08092020 - v0.1 6 | # current version dd 21072023 - v0.91 7 | 8 | # ask each time to install a program 9 | if [ ! -z $1 ]; then 10 | if [ $1 = "auto" ]; then 11 | auto=1 12 | fi 13 | else 14 | auto=0 15 | fi 16 | 17 | # do you want to install cuda (only for an nvidia GPU) 18 | install_cuda=1 19 | 20 | 21 | # Define the install location 22 | install_location=/usr/local/KUL_apps 23 | KUL_apps_config="${install_location}/KUL_apps_config" 24 | KUL_apps_versions="${install_location}/KUL_apps_versions" 25 | 26 | 27 | # check the operating system 28 | # 1 for macOS 29 | # 2 for WSL2 30 | # 3 for Ubuntu 31 | if [[ $(uname | grep Darwin) ]];then 32 | local_os=1 33 | os_name="macOS" 34 | bashfile=$HOME/.bash_profile 35 | elif [[ $(grep microsoft /proc/version) ]]; then 36 | local_os=2 37 | os_name="Windows-WSL2" 38 | bashfile=$HOME/.bashrc 39 | else 40 | local_os=3 41 | os_name="Linux" 42 | bashfile=$HOME/.bashrc 43 | fi 44 | echo "This script will install a lot of neuro-imaging software on ${os_name}" 45 | 46 | 47 | # Define functions to keep installation of things tidy 48 | function install_KUL_apps { 49 | cd ${install_location} 50 | source $bashfile 51 | echo -e "\n" 52 | do_not_install=0 53 | if [ $auto -eq 0 ]; then 54 | read -r -p "Proceed with the installation of $1? [Y/n] " prompt 55 | prompt=${prompt:-y} 56 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then 57 | echo 'OK we continue' 58 | else 59 | do_not_install=1 60 | fi 61 | fi 62 | } 63 | 64 | 65 | # Give some information & ask permission to continue (if not yet done so) 66 | if [ ! -f $HOME/.KUL_apps_install_yes ]; then 67 | echo " for details see https://github.com/treanus/KUL_Linux_Installation" 68 | echo " it will take several hours to install (and compile, if needed) all software." 69 | echo " You may have to exit the shell several times, after which you have to restart the script." 70 | echo " The script will check what has already been installed and continue installing software" 71 | echo " This script may ask you a several times for your password in order to install software (sudo usage)" 72 | read -r -p "Proceed with the installation? [Y/n] " prompt 73 | prompt=${prompt:-y} 74 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then 75 | echo 'OK we continue' 76 | touch $HOME/.KUL_apps_install_yes 77 | else 78 | exit 79 | fi 80 | fi 81 | 82 | 83 | # Check if users have installed dependancies for WSL2 84 | if [ $local_os -eq 2 ] && [ ! -f $HOME/.KUL_apps_install_wsl2_yes ]; then 85 | echo -e "\n" 86 | echo "You are running WSL" 87 | echo " this script only works well on WSL2 in win11 (or latest preview win10)" 88 | echo " be sure to INSTALL FIRST ON WIN11: " 89 | echo " 1/ enable nvidia cuda in WSL following https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl " 90 | echo " 2/ install docker in win11 and setup wsl2 - ubuntu integration" 91 | echo " otherwise, exit the script (answer "no" below) and do this first" 92 | read -r -p "Proceed with the installation? [Y/n] " prompt 93 | prompt=${prompt:-y} 94 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] 95 | then 96 | echo 'OK we continue' 97 | touch $HOME/.KUL_apps_install_wsl2_yes 98 | else 99 | exit 100 | fi 101 | fi 102 | 103 | 104 | # ---- MAIN ---- 105 | 106 | # Now make the install directory 107 | if [ ! -f ${install_location}/.KUL_apps_make_installdir ]; then 108 | echo "Making the install directory, readable and executable for all users" 109 | echo " you might have to give your password (if needed)" 110 | sleep 3 111 | # Determine group id 112 | kul_group=$(id -g) 113 | #echo $kul_group 114 | sudo mkdir -p ${install_location} 115 | sudo chgrp -R ${kul_group} ${install_location} 116 | sudo chmod -R 770 ${install_location} 117 | touch ${install_location}/.KUL_apps_make_installdir 118 | fi 119 | 120 | 121 | # Install requirements - TODO: check what is *really* needed! 122 | if [ ! -f ${install_location}/.KUL_apps_install_required_yes ]; then 123 | 124 | # LINUX AND WSL2 125 | if [ $local_os -gt 1 ]; then 126 | echo -e "\n" 127 | echo "We first install a number of needed packages" 128 | echo 'The system will now ask for your password (if needed) to update and upgrade all linux system software' 129 | sleep 4 130 | sudo apt update 131 | sudo apt upgrade 132 | # sudo apt -y install \ 133 | # git \ 134 | # htop \ 135 | # libgl1-mesa-glx \ 136 | # libegl1-mesa \ 137 | # libxrandr2 \ 138 | # libxss1 \ 139 | # libxcursor1 \ 140 | # libxcomposite1 \ 141 | # libasound2 \ 142 | # libxi6 \ 143 | # libxtst6 \ 144 | # g++ \ 145 | # freeglut3-dev \ 146 | # build-essential \ 147 | # libx11-dev \ 148 | # zlib1g-dev \ 149 | # libxmu-dev \ 150 | # libxi-dev \ 151 | # libglu1-mesa \ 152 | # libglu1-mesa-dev \ 153 | # libfreeimage-dev \ 154 | # libeigen3-dev \ 155 | # libqt5opengl5-dev \ 156 | # libqt5svg5-dev \ 157 | # libgl1-mesa-dev \ 158 | # libfftw3-dev \ 159 | # libtiff5-dev \ 160 | # libpng-dev \ 161 | # python3-distutils \ 162 | # tcsh \ 163 | # cmake \ 164 | # pkg-config \ 165 | # libncurses5-dev \ 166 | # libncursesw5-dev \ 167 | # libblas-dev \ 168 | # liblapack-dev \ 169 | # libopenblas0 \ 170 | # dc \ 171 | # mesa-utils \ 172 | # gedit \ 173 | # pulseaudio \ 174 | # libquadmath0 \ 175 | # libgtk2.0-0 \ 176 | # mmv \ 177 | # glances \ 178 | # numlockx \ 179 | # glibc-source 180 | 181 | sudo apt -y install \ 182 | git \ 183 | htop \ 184 | glances \ 185 | build-essential \ 186 | mmv \ 187 | numlockx \ 188 | g++ \ 189 | libeigen3-dev \ 190 | zlib1g-dev libqt5opengl5-dev libqt5svg5-dev libgl1-mesa-dev \ 191 | libfftw3-dev libtiff5-dev libpng-dev \ 192 | cmake pkg-config \ 193 | nvtop \ 194 | tcsh \ 195 | imagemagick 196 | 197 | 198 | if [ $local_os -eq 2 ];then 199 | sudo apt -y install nautilus 200 | fi 201 | touch ${install_location}/.KUL_apps_install_required_yes 202 | 203 | 204 | # macOS 205 | elif [ $local_os -eq 1 ]; then 206 | 207 | # Install command line developer tools 208 | if xcode-select --install 2>&1 | grep installed; then 209 | echo "Already installed command line developer tools - ignore the warning/error" 210 | else 211 | echo -e "\n\n\n" 212 | echo "Installing command line developer tools" 213 | sleep 3 214 | xcode-select --install 215 | fi 216 | 217 | # Check for Homebrew, install if we don't have it 218 | if ! command -v brew &> /dev/null; then 219 | echo -e "\n\n\n" 220 | echo "Installing brew" 221 | sleep 3 222 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 223 | fi 224 | 225 | # Update homebrew recipes 226 | brew update 227 | 228 | # install a number of brew packages 229 | echo -e "\n\n\n" 230 | echo "Installing packages..." 231 | echo " you may see errors or warnings if packages are already installed" 232 | sleep 3 233 | brew install git 234 | brew install hub 235 | brew install jq 236 | brew install wget 237 | brew install eigen 238 | brew install qt 239 | brew install pkg-config 240 | brew install libtiff 241 | brew install fftw 242 | brew install mmv 243 | brew install cmake 244 | brew install netpbm 245 | brew install openblas 246 | brew install zlib 247 | brew install lapack 248 | brew install htop 249 | 250 | echo -e "\n\n\n" 251 | echo "Installing cask apps..." 252 | echo " you may see errors or warnings if programs are already installed" 253 | sleep 3 254 | brew install --cask visual-studio-code 255 | brew install --cask xquartz 256 | brew install --cask cyberduck 257 | brew install --cask docker 258 | brew install --cask firefox 259 | brew install --cask menumeters 260 | brew install --cask osirix-quicklook 261 | brew install --cask quicklook-json 262 | brew install --cask quicklook-csv 263 | brew install --cask itk-snap 264 | 265 | echo -e "\n\n\n" 266 | echo "KUL_Install_NeuroImagingSoftware:" 267 | echo "Now:" 268 | echo " 1/ manually setup docker (open app and set up)" 269 | echo " 2/ if you are behind a strict (hospital/university) firewall you may want to copy the line below:" 270 | echo " git config --global url."https://".insteadOf git://" 271 | echo " into another terminal and execute" 272 | echo " 3/ reboot and run the KNT_Linux_install.sh again from a new terminal" 273 | touch ${install_location}/.KUL_apps_install_required_yes 274 | exit 275 | 276 | fi 277 | fi 278 | 279 | 280 | # initiate the config file to be sourced by ${bashfile} 281 | if [ ! -f ${KUL_apps_config} ]; then 282 | # the KUL_apps_config 283 | echo "export KUL_apps_DIR="${install_location}"" > ${KUL_apps_config} 284 | # the KUL_apps_version 285 | cat < $KUL_apps_versions 286 | #!/bin/bash 287 | EOT 288 | # update ${bashfile} 289 | echo "" >> ${bashfile} 290 | echo "# Source the KUL_apps and other neuroimaging software" >> ${bashfile} 291 | echo "source ${KUL_apps_config}" >> ${bashfile} 292 | source ${bashfile} 293 | sleep 4 294 | fi 295 | 296 | # Setup some useful stuff 297 | if ! [ -f "${install_location}/.KUL_apps_useful_installed" ] 298 | then 299 | echo "Setting up useful aliases " 300 | 301 | echo "# KUL_apps - Setting up some useful stuff" >> ${KUL_apps_config} 302 | echo "alias ll='ls -alhF'" >> ${KUL_apps_config} 303 | if [ $local_os -eq 1 ];then 304 | echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ${KUL_apps_config} 305 | echo "export PATH=\$HOME/.local/bin:\$PATH" >> ${KUL_apps_config} 306 | fi 307 | if [ $local_os -eq 2 ];then 308 | echo "alias code='code &'" >> ${KUL_apps_config} 309 | fi 310 | touch ${install_location}/.KUL_apps_useful_installed 311 | else 312 | echo "Already set up useful aliases" 313 | fi 314 | 315 | 316 | # install cuda toolkit 317 | if [ $local_os -eq 2 ]; then 318 | echo "Already installed cuda in win11" 319 | elif [ $local_os -eq 3 ]; then 320 | if [ $install_cuda -eq 1 ]; then 321 | if ! command -v nvcc &> /dev/null 322 | then 323 | wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb 324 | sudo dpkg -i cuda-keyring_1.1-1_all.deb 325 | sudo apt-get update 326 | sudo apt-get -y install cuda-toolkit-12-3 327 | 328 | cat <> ${KUL_apps_config} 329 | # adding cuda_toolkit 330 | export PATH=/usr/local/cuda/bin\${PATH:+:\${PATH}} 331 | export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH} 332 | 333 | EOT 334 | fi 335 | else 336 | echo "Already installed cuda" 337 | fi 338 | elif [ $local_os -eq 1 ]; then 339 | echo "Not installing cuda on macOS (no nvidia cards available)" 340 | fi 341 | 342 | 343 | # Installation of Visual Studio Code 344 | if ! [ command -v code &> /dev/null ] && [ $local_os -gt 1 ]; then 345 | wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg 346 | sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/ 347 | sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' 348 | sudo apt-get -y install apt-transport-https 349 | sudo apt-get -y update 350 | sudo apt-get -y install code 351 | rm packages.microsoft.gpg 352 | else 353 | echo "Already installed Visual Studio Code" 354 | fi 355 | 356 | 357 | # Installation of FSL 358 | if ! command -v fslmaths &> /dev/null; then 359 | install_KUL_apps "FSL" 360 | if [ $do_not_install -eq 0 ]; then 361 | #if [ $local_os -eq 2 ]; then 362 | # sudo apt-get -y install dc python mesa-utils gedit pulseaudio libquadmath0 libgtk2.0-0 firefox 363 | #fi 364 | wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/fslinstaller.py 365 | #if [ $local_os -gt 1 ]; then 366 | # sudo apt-get -y install python2.7 367 | #fi 368 | echo -e "\n\n\n" 369 | echo "Here we give the installation instructions for FSL..." 370 | echo "it is ok to install to the default /usr/local/fsl directory" 371 | read -p "Press any key to continue... " -n1 -s 372 | python3 fslinstaller.py -d /usr/local/fsl -s 373 | rm fslinstaller.py 374 | cat <> ${KUL_apps_config} 375 | # Installing FSL 376 | FSLDIR=/usr/local/fsl 377 | PATH=\${FSLDIR}/share/fsl/bin:\${PATH} 378 | export FSLDIR PATH 379 | . \${FSLDIR}/etc/fslconf/fsl.sh 380 | 381 | EOT 382 | echo "echo -e \"\t FSL\t\t-\t\$(cat \$FSLDIR/etc/fslversion)\"" >> $KUL_apps_versions 383 | else 384 | echo "ok - you choose not to install FSL" 385 | fi 386 | else 387 | echo "Already installed FSL" 388 | fi 389 | 390 | 391 | # Installation of Freesurfer 392 | if 0; then 393 | if ! command -v freeview &> /dev/null; then 394 | echo "KUL_apps: which version do you want to install" 395 | echo " 1 - v6.0.0" 396 | echo " 2 - v7.2.0" 397 | echo " 3 - v7.4.1" 398 | read -r -p "Freesurfer version: [1/2/3] " fs_prompt 399 | if [[ $fs_prompt == "3" ]]; then 400 | freesurfer_version="7.4.1" 401 | if [ $local_os -eq 1 ]; then 402 | freesurfer_file="freesurfer-macOS-darwin_x86_64-7.4.1" 403 | else 404 | freesurfer_file="freesurfer-linux-ubuntu22_amd64-7.4.1" 405 | fi 406 | elif [[ $fs_prompt == "2" ]]; then 407 | freesurfer_version="7.2.0" 408 | if [ $local_os -eq 1 ]; then 409 | freesurfer_file="freesurfer-macOS-darwin_x86_64-7.2.0" 410 | else 411 | freesurfer_file="freesurfer-linux-ubuntu18_amd64-7.2.0" 412 | fi 413 | else 414 | freesurfer_version="6.0.0" 415 | if [ $local_os -eq 1 ]; then 416 | freesurfer_file="freesurfer-Darwin-OSX-stable-pub-v6.0.0" 417 | else 418 | freesurfer_file="freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0" 419 | fi 420 | fi 421 | install_KUL_apps "Freesurfer v ${freesurfer_version}" 422 | if [ $do_not_install -eq 0 ]; then 423 | wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/${freesurfer_version}/${freesurfer_file}.tar.gz 424 | tar -zxvpf ${freesurfer_file}.tar.gz 425 | cat <> ${KUL_apps_config} 426 | # adding freesurfer 427 | export FREESURFER_HOME=${install_location}/freesurfer 428 | export SUBJECTS_DIR=\$FREESURFER_HOME/subjects 429 | export FS_LICENSE=\$FREESURFER_HOME/license.txt 430 | source \$FREESURFER_HOME/SetUpFreeSurfer.sh 431 | 432 | EOT 433 | 434 | echo "echo -e \"\t freesurfer\t-\t\$(recon-all -version) \"" >> $KUL_apps_versions 435 | echo "if [ ! -f \$FREESURFER_HOME/license.txt ]; then" >> ${KUL_apps_versions} 436 | echo " echo -e \"\t\t Warning: no freesufer license found in \${FREESURFER_HOME}\"" >> ${KUL_apps_versions} 437 | echo "fi" >> ${KUL_apps_versions} 438 | echo "Install the license.txt into \${FREESURFER_HOME}" 439 | rm ${freesurfer_file}.tar.gz 440 | else 441 | echo "ok - you choose not to install Freesurfer" 442 | fi 443 | else 444 | echo "Already installed Freesurfer ${freesurfer_version}" 445 | fi 446 | fi 447 | 448 | # Installation of Docker 449 | if ! command -v docker &> /dev/null; then 450 | if [ $local_os -gt 1 ]; then 451 | install_KUL_apps "Docker" 452 | if [ $do_not_install -eq 0 ]; then 453 | for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done 454 | #sudo apt-get -y remove docker docker-engine docker.io 455 | sudo apt-get -y update 456 | sudo apt-get -y install docker.io 457 | sudo systemctl start docker 458 | sudo systemctl enable docker 459 | sudo groupadd docker 460 | sudo usermod -aG docker $USER 461 | newgrp docker 462 | 463 | # now for gpu capability 464 | sudo apt-get update 465 | sudo apt-get install -y nvidia-docker2 466 | sudo systemctl restart docker 467 | 468 | else 469 | echo "ok - you choose not to install Docker - it is essential though in most cases..." 470 | fi 471 | fi 472 | else 473 | echo "Already installed Docker" 474 | fi 475 | 476 | 477 | # Installation of MRtrix3 478 | if ! command -v mrconvert &> /dev/null; then 479 | install_KUL_apps "MRtrix3" 480 | if [ $do_not_install -eq 0 ]; then 481 | echo "KUL_apps: which version do you want to install" 482 | echo " 1 - stable" 483 | echo " 2 - development" 484 | read -r -p "MRtrix3 version: [1/2] " mrtrix3_prompt 485 | git clone https://github.com/MRtrix3/mrtrix3.git 486 | cd mrtrix3 487 | oldpath=$PATH 488 | if [[ $mrtrix3_prompt == "2" ]]; then 489 | git checkout dev 490 | apt install ninja-build ccache pre-commit 491 | pre-commit install 492 | cmake -GNinja -B build -DCMAKE_INSTALL_PREFIX=/usr/local/KUL_apps/mrtrix3 493 | cmake --build build 494 | cmake --install build 495 | else 496 | if [ $local_os -eq 1 ];then 497 | ./configure -conda 498 | else 499 | export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin #FSL has own inlcude files 8-( 500 | ./configure 501 | fi 502 | ./build 503 | fi 504 | export PATH=$oldpath 505 | # begin cat command - see below 506 | cat <> ${KUL_apps_config} 507 | # adding MRTRIX3 508 | export PATH=${install_location}/mrtrix3/bin:\$PATH 509 | 510 | EOT 511 | # end cat command - see above 512 | ${install_location}/mrtrix3/install_mime_types.sh 513 | 514 | echo "echo -e \"\t mrtrix3\t-\t\$(mrconvert -version | head -1 | awk '{ print \$3 }') \"" >> $KUL_apps_versions 515 | else 516 | echo "ok - you choose not to install MRtrix3" 517 | fi 518 | else 519 | echo "Already installed MRtrix3" 520 | fi 521 | 522 | 523 | # Installation of shard-recon 524 | if ! command -v dwimotioncorrect &> /dev/null; then 525 | install_KUL_apps "shard-recon" 526 | if [ $do_not_install -eq 0 ]; then 527 | oldpath=$PATH 528 | export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin #FSL has own inlcude files 8-( 529 | git clone https://github.com/dchristiaens/shard-recon.git 530 | cd shard-recon 531 | ln -s ${install_location}/mrtrix3/build 532 | ln -s ${install_location}/mrtrix3/bin/mrtrix3.py bin/ 533 | ./build 534 | export PATH=$oldpath 535 | # begin cat command - see below 536 | cat <> ${KUL_apps_config} 537 | # adding shard-recon 538 | export PATH=${install_location}/shard-recon/bin:\$PATH 539 | 540 | EOT 541 | 542 | else 543 | echo "ok - you choose not to install shard-recon" 544 | fi 545 | else 546 | echo "Already installed shard-recon" 547 | fi 548 | 549 | 550 | # Installation of Ants 551 | if ! [ -d "${install_location}/ANTs_installed" ]; then 552 | install_KUL_apps "Ants" 553 | if [ $do_not_install -eq 0 ]; then 554 | wget https://raw.githubusercontent.com/cookpa/antsInstallExample/master/installANTs.sh 555 | chmod +x installANTs.sh 556 | #if [ $local_os -gt 1 ]; then 557 | # sudo apt-get -y install cmake pkg-config 558 | #fi 559 | ./installANTs.sh 560 | mv install ANTs_installed 561 | rm installANTs.sh 562 | rm -rf build 563 | cd 564 | cat <> ${KUL_apps_config} 565 | # adding ANTs 566 | export ANTSPATH=${install_location}/ANTs_installed/bin/ 567 | export PATH=\${ANTSPATH}:\$PATH 568 | 569 | EOT 570 | echo "echo -e \"\t ants\t\t-\t\$(antsRegistration --version | head -1 | awk '{ print \$3 }') \"" >> $KUL_apps_versions 571 | else 572 | echo "ok - you choose not to install Ants" 573 | fi 574 | else 575 | echo "Already installed ANTs" 576 | fi 577 | 578 | 579 | # Installation of DCMTK 580 | if ! command -v storescu &> /dev/null; then 581 | install_KUL_apps "DCMTK" 582 | if [ $do_not_install -eq 0 ]; then 583 | if [ $local_os -eq 1 ]; then 584 | brew install dcmtk 585 | else 586 | sudo apt-get -y install dcmtk 587 | fi 588 | else 589 | echo "ok - you choose not to install DCMTK" 590 | fi 591 | else 592 | echo "Already installed DCMTK" 593 | fi 594 | 595 | 596 | # Installation of GDCM (other dicom tools) 597 | if ! command -v gdcmtar &> /dev/null; then 598 | install_KUL_apps "GDCM" 599 | if [ $do_not_install -eq 0 ]; then 600 | if [ $local_os -eq 1 ]; then 601 | brew install gdcm 602 | else 603 | sudo apt-get -y install libgdcm-tools 604 | fi 605 | else 606 | echo "ok - you choose not to install GDCM" 607 | fi 608 | else 609 | echo "Already installed GDCM" 610 | fi 611 | 612 | 613 | # Installation of KUL_NIS (KULeuven Neuro Imaging Suite) 614 | if ! [ -d "${install_location}/KUL_NIS" ]; then 615 | install_KUL_apps "KUL_NIS" 616 | if [ $do_not_install -eq 0 ]; then 617 | git clone https://github.com/treanus/KUL_NIS.git 618 | cat <> ${KUL_apps_config} 619 | # adding KUL_NIS (KULeuven Neuro Imaging Suite) 620 | export PATH=${install_location}/KUL_NIS:\$PATH 621 | export PYTHONPATH=${install_location}/mrtrix3/lib:\$PYTHONPATH 622 | 623 | EOT 624 | echo "echo -e \"\t KUL_NIS\t-\t\$(cd $KUL_apps_DIR/KUL_NIS; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 625 | else 626 | echo "ok - you choose not to install KUL_NIS" 627 | fi 628 | else 629 | echo "Already installed KUL_NIS" 630 | fi 631 | 632 | 633 | # Installation of dcm2niix 634 | if ! command -v dcm2niix &> /dev/null; then 635 | install_KUL_apps "dcm2niix" 636 | if [ $do_not_install -eq 0 ]; then 637 | oldpath=$PATH 638 | export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin #FSL has own inlcude files 8-( 639 | git clone https://github.com/rordenlab/dcm2niix.git 640 | cd dcm2niix 641 | mkdir build && cd build 642 | cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON .. 643 | make 644 | export PATH=$oldpath 645 | cat <> ${KUL_apps_config} 646 | # adding dcm2nixx 647 | export PATH=${install_location}/dcm2niix/build/bin:\$PATH 648 | 649 | EOT 650 | echo "echo -e \"\t dcm2nixx\t-\t\$(dcm2niix --version | head -1 | awk '{ print \$5 }') \"" >> $KUL_apps_versions 651 | else 652 | echo "ok - you choose not to install dcm2niix" 653 | fi 654 | else 655 | echo "Already installed dcm2niix" 656 | fi 657 | 658 | 659 | # download a number of Docker containers 660 | if [ ! -f ${install_location}/.KUL_apps_install_containers_yes ]; then 661 | echo "Now installing some useful docker containers" 662 | sleep 3 663 | if [ $local_os -eq 1 ]; then 664 | echo -e "\n\n\n" 665 | echo "Here we give the installation instructions for docker containers on macOS..." 666 | echo "See to it that Docker Desktop is setup and running" 667 | read -p "Press any key to continue... " -n1 -s 668 | echo "Not installing hd-glio-auto on macOS (no compatible GPU)" 669 | echo "echo -e \"\t hd-glio-auto\t-\tcannot be installed (no compatible GPU) \"" >> $KUL_apps_versions 670 | else 671 | docker pull jenspetersen/hd-glio-auto 672 | echo "echo -e \"\t hd-glio-auto\t-\tcannot be checked (but latest docker) \"" >> $KUL_apps_versions 673 | fi 674 | touch ${install_location}/.KUL_apps_install_containers_yes 675 | else 676 | echo "Already installed required docker containers" 677 | fi 678 | 679 | 680 | # Installation of SPM12 681 | if ! [ -d "${install_location}/spm12" ]; then 682 | install_KUL_apps "spm12" 683 | if [ $do_not_install -eq 0 ]; then 684 | wget https://www.fil.ion.ucl.ac.uk/spm/download/restricted/eldorado/spm12.zip 685 | unzip spm12.zip 686 | #Note: Matlab needs to be installed first to compile the mex files 687 | read -r -p "Do you want to recompile to SPM binaries (if so, you need to have matlab installed and set up) [y/n] " prompt 688 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] 689 | then 690 | echo 'OK we continue' 691 | cd spm12/src 692 | make distclean 693 | make && make install 694 | make external-distclean 695 | make external && make external-install 696 | cd ${install_location} 697 | fi 698 | rm spm12.zip 699 | echo "echo -e \"\t spm12\t\t-\tcheck from within matlab please \"" >> $KUL_apps_versions 700 | else 701 | echo "ok - you choose not to install spm12. Do not install cat12, lead-dbs and conn since it depends on it" 702 | fi 703 | else 704 | echo "Already installed spm12" 705 | fi 706 | 707 | 708 | # Installation of cat12 709 | if ! [ -d "${install_location}/spm12/toolbox/cat12" ]; then 710 | install_KUL_apps "cat12" 711 | if [ $do_not_install -eq 0 ]; then 712 | wget http://www.neuro.uni-jena.de/cat12/cat12_latest.zip 713 | unzip cat12_latest.zip -d spm12/toolbox 714 | rm cat12_latest.zip 715 | echo "echo -e \"\t cat12\t\t-\tcheck from within matlab please \"" >> $KUL_apps_versions 716 | else 717 | echo "ok - you choose not to install cat12" 718 | fi 719 | else 720 | echo "Already installed cat12" 721 | fi 722 | 723 | 724 | # Installation of Lead-DBS 725 | if ! [ -d "${install_location}/leaddbs" ]; then 726 | install_KUL_apps "Lead-DBS" 727 | if [ $do_not_install -eq 0 ]; then 728 | git clone https://github.com/netstim/leaddbs.git 729 | wget -O leaddbs_data.zip http://www.lead-dbs.org/release/download.php?id=data_pcloud 730 | echo -e "\n\n\n" 731 | echo "Here we give the installation instructions for Lead-dbs..." 732 | echo "answer yes when asked to replace templates" 733 | read -p "Press any key to continue... " -n1 -s 734 | unzip leaddbs_data.zip -d leaddbs/ 735 | rm leaddbs_data.zip 736 | echo "echo -e \"\t Lead-DBS\t-\tcheck from within matlab please \"" >> $KUL_apps_versions 737 | else 738 | echo "ok - you choose not to install Lead-DBS" 739 | fi 740 | else 741 | echo "Already installed Lead-DBS" 742 | fi 743 | 744 | 745 | # Installation of CONN 746 | conn_version="con22a" 747 | if ! [ -d "${install_location}/${conn_version}" ]; then 748 | install_KUL_apps "conn-toolbox version ${conn_version}" 749 | if [ $do_not_install -eq 0 ]; then 750 | wget https://www.nitrc.org/frs/download.php/11714/${conn_version}.zip 751 | unzip ${conn_version}.zip 752 | mv conn ${conn_version} 753 | rm ${conn_version}.zip 754 | echo "echo -e \"\t conn\t\t-\t${conn_version} \"" >> $KUL_apps_versions 755 | else 756 | echo "ok - you choose not to install ${conn_version}" 757 | fi 758 | else 759 | echo "Already installed conn-toolbox version ${conn_version}" 760 | fi 761 | 762 | 763 | # Installation of VBG 764 | if ! [ -d "${install_location}/KUL_VBG" ]; then 765 | install_KUL_apps "KUL_VBG" 766 | if [ $do_not_install -eq 0 ]; then 767 | git clone https://github.com/treanus/KUL_VBG.git 768 | cat <> ${KUL_apps_config} 769 | # adding KUL_VBG 770 | export PATH=${install_location}/KUL_VBG:\$PATH 771 | 772 | EOT 773 | echo "echo -e \"\t KUL_VBG\t-\t\$(cd $KUL_apps_DIR/KUL_VBG; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 774 | else 775 | echo "ok - you choose not to install KUL_VBG" 776 | fi 777 | else 778 | echo "Already installed KUL_VBG" 779 | fi 780 | 781 | 782 | # Installation of FWT 783 | if ! [ -d "${install_location}/KUL_FWT" ] 784 | then 785 | install_KUL_apps "KUL_FWT" 786 | if [ $do_not_install -eq 0 ]; then 787 | git clone https://github.com/treanus/KUL_FWT.git 788 | cd KUL_FWT 789 | git checkout dev 790 | cd .. 791 | cat <> ${KUL_apps_config} 792 | # adding KUL_FWT 793 | export PATH="${install_location}/KUL_FWT:\$PATH" 794 | 795 | EOT 796 | echo "echo -e \"\t KUL_FWT\t-\t\$(cd $KUL_apps_DIR/KUL_FWT; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 797 | else 798 | echo "ok - you choose not to install KUL_FWT" 799 | fi 800 | else 801 | echo "Already installed KUL_FWT" 802 | fi 803 | 804 | 805 | # Installation of Mevislab 3.7 806 | if ! [ -f "${install_location}/.KUL_apps_installed_mevislab" ]; then 807 | install_KUL_apps "Mevislab 3.7" 808 | if [ $do_not_install -eq 0 ]; then 809 | if [ $local_os -eq 1 ]; then 810 | 811 | ml_file="https://mevislabdownloads.mevis.de/Download/MeVisLab3.4.2/Mac/X86-64/MeVisLabSDK3.4.2_x86-64.dm" 812 | wget $ml_file 813 | hdiutil mount $ml_file 814 | sudo cp -R /Volumes/MeVisLabSDK/MeVisLab.app /Applications 815 | hdiutil unmount /Volumes/MeVisLabSDK 816 | rm $ml_file 817 | else 818 | sudo apt-get install libxcb-xinput0 libxcb-xinerama0 819 | mv_vers="3.7.2" 820 | wget https://mevislabdownloads.mevis.de/Download/MeVisLab${mv_vers}/Linux/GCC11-64/MeVisLabSDK${mv_vers}_gcc11-64.bin 821 | chmod u+x MeVisLabSDK${mv_vers}_gcc11-64.bin 822 | mkdir MeVisLabSDK${mv_vers} 823 | ./MeVisLabSDK${mv_vers}_gcc11-64.bin --prefix ${install_location}/MeVisLabSDK${mv_vers} --mode silent 824 | rm MeVisLabSDK${mv_vers}_gcc11-64.bin 825 | fi 826 | touch ${install_location}/.KUL_apps_installed_mevislab 827 | else 828 | echo "ok - you choose not to install Mevislab 3.7" 829 | fi 830 | else 831 | echo "Already installed MevislabSDK3.7" 832 | fi 833 | 834 | 835 | # Installation of Anaconda --- BEGIN 836 | if ! [ -d "${install_location}/anaconda3/" ]; then 837 | install_KUL_apps "Anaconda3" 838 | if [ $do_not_install -eq 0 ]; then 839 | if [ $local_os -eq 1 ]; then 840 | anaconda_version=Anaconda3-2021.05-MacOSX-x86_64.pkg 841 | wget https://repo.anaconda.com/archive/${anaconda_version} 842 | sudo installer -pkg ${anaconda_version} -target ${install_location} 843 | else 844 | anaconda_version=Anaconda3-2023.09-0-Linux-x86_64.sh 845 | #sudo apt-get -y install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 846 | wget https://repo.anaconda.com/archive/${anaconda_version} 847 | echo -e "\n\n" 848 | echo "Here we give the installation instructions for anaconda..." 849 | echo "ACCEPT THE LICENSE" 850 | echo "INSTALL DIRECTORY = /usr/local/KUL_apps/anaconda3" 851 | echo "Say NO initialize Anaconda3" 852 | read -p "Press any key to continue... " -n1 -s 853 | bash ${anaconda_version} -p ${install_location}/anaconda3 854 | echo "" >> ${KUL_apps_config} 855 | echo "# load Anaconda3" 856 | 857 | # begin cat command - see below 858 | cat <> ${KUL_apps_config} 859 | # >>> conda initialize >>> 860 | # !! Contents within this block are managed by 'conda init' !! 861 | __conda_setup="\$('/usr/local/KUL_apps/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" 862 | if [ \$? -eq 0 ]; then 863 | eval "\$__conda_setup" 864 | else 865 | if [ -f "/usr/local/KUL_apps/anaconda3/etc/profile.d/conda.sh" ]; then 866 | . "/usr/local/KUL_apps/anaconda3/etc/profile.d/conda.sh" 867 | else 868 | export PATH="/usr/local/KUL_apps/anaconda3/bin:\$PATH" 869 | fi 870 | fi 871 | unset __conda_setup 872 | # <<< conda initialize <<< 873 | 874 | EOT 875 | # end cat command - see above 876 | 877 | fi 878 | 879 | rm ${anaconda_version} 880 | echo "echo -e \"\t Anaconda3\t-\t${anaconda_version}" \" >> $KUL_apps_versions 881 | echo -e "\n\n\n" 882 | echo "Now exit all ${os_name} terminals and run the KNT_Linux_install.sh again from a new terminal" 883 | 884 | exit 885 | 886 | else 887 | echo "Ananconda is really essential - don't know what to do but exit" 888 | exit 889 | fi 890 | else 891 | echo "Already installed Anaconda3" 892 | fi 893 | # Installation of Anaconda --- END 894 | 895 | 896 | # adding some more 897 | #pip install py3nvml glances 898 | #pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 899 | 900 | 901 | # Installation of dcm2bids 902 | if ! command -v dcm2bids &> /dev/null; then 903 | install_KUL_apps "dcm2bids" 904 | if [ $do_not_install -eq 0 ]; then 905 | conda install -y -c conda-forge dcm2bids 906 | echo "echo -e \"\t dcm2bids\t-\t\$(dcm2bids -h | grep dcm2bids | tail -1 | awk '{ print \$2 }') \"" >> $KUL_apps_versions 907 | else 908 | echo "ok - you choose not to install dcm2bids" 909 | fi 910 | else 911 | echo "Already installed dcm2bids" 912 | fi 913 | 914 | 915 | # Installation of HD-BET 916 | if ! command -v hd-bet &> /dev/null 917 | then 918 | install_KUL_apps "HD-BET" 919 | if [ $do_not_install -eq 0 ]; then 920 | git clone https://github.com/MIC-DKFZ/HD-BET 921 | cd HD-BET 922 | if [ $local_os -eq 1 ]; then 923 | sudo pip install -e . # sudo needed for macOS, yes 924 | else 925 | pip install -e . 926 | fi 927 | cd 928 | echo "echo -e \"\t HD-BET\t\t-\t\$(cd $KUL_apps_DIR/HD-BET; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 929 | if [ $local_os -eq 1 ]; then 930 | echo "" >> ${KUL_apps_config} 931 | echo "# Setting up HD-BET" >> ${KUL_apps_config} 932 | echo "alias hd-bet='hd-bet -device cpu -mode fast -tta 0 ' " >> ${KUL_apps_config} 933 | fi 934 | else 935 | echo "ok - you choose not to install HD-BET" 936 | fi 937 | else 938 | echo "Already installed HD-BET" 939 | fi 940 | 941 | 942 | # Installation of HD-GLIO(-AUTO) 943 | if ! command -v hd_glio_predict &> /dev/null 944 | then 945 | install_KUL_apps "HD-GLIO-AUTO" 946 | if [ $do_not_install -eq 0 ]; then 947 | git clone https://github.com/NeuroAI-HD/HD-GLIO-AUTO.git 948 | git clone https://github.com/NeuroAI-HD/HD-GLIO.git 949 | cd HD-GLIO 950 | pip install -e . 951 | echo "echo -e \"\t HD-GLIO-AUTO\t-\t\$(cd $KUL_apps_DIR/HD-GLIO-AUTO; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 952 | else 953 | echo "ok - you choose not to install HD-BET" 954 | fi 955 | else 956 | echo "Already installed HD-BET" 957 | fi 958 | 959 | 960 | # Installation of Scilpy 961 | if ! [ -d "${install_location}/scilpy/" ]; then 962 | install_KUL_apps "Scilpy" 963 | if [ $do_not_install -eq 0 ]; then 964 | #if [ $local_os -gt 1 ]; then 965 | # sudo apt-get -y install libblas-dev liblapack-dev 966 | #fi 967 | sudo apt install libblas-dev liblapack-dev libfreetype6-dev 968 | git clone https://github.com/scilus/scilpy.git 969 | cd scilpy 970 | conda create --name scilpy python=3.10 971 | eval "$(conda shell.bash hook)" 972 | conda activate scilpy 973 | pip install -e . 974 | conda deactivate 975 | echo "echo -e \"\t scilpy\t\t-\t\$(cd $KUL_apps_DIR/scilpy; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 976 | else 977 | echo "ok - you choose not to install Scilpy" 978 | fi 979 | else 980 | echo "Already installed Scilpy" 981 | fi 982 | 983 | 984 | # Installation of resseg 985 | if ! [ -d "${install_location}/.KUL_apps_installed_resseg" ]; then 986 | install_KUL_apps "resseg" 987 | if [ $do_not_install -eq 0 ]; then 988 | conda create -n resseg python=3.8 -y 989 | eval "$(conda shell.bash hook)" 990 | conda activate resseg 991 | pip install light-the-torch 992 | ltt install torch 993 | pip install antspyx 994 | pip install resseg 995 | conda deactivate 996 | touch "${install_location}/.KUL_apps_installed_resseg" 997 | #echo "echo -e \"\t scilpy\t\t-\t\$(cd $KUL_apps_DIR/scilpy; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 998 | else 999 | echo "ok - you choose not to install Scilpy" 1000 | fi 1001 | else 1002 | echo "Already installed Scilpy" 1003 | fi 1004 | 1005 | 1006 | # Installation of FastSurfer 1007 | if ! [ -d "${install_location}/FastSurfer/" ] && [ $local_os -gt 1 ]; then 1008 | install_KUL_apps "FastSurfer" 1009 | if [ $do_not_install -eq 0 ]; then 1010 | git clone https://github.com/Deep-MI/FastSurfer.git 1011 | cd FastSurfer 1012 | conda env create -f ./fastsurfer.yml 1013 | #eval "$(conda shell.bash hook)" 1014 | #conda activate fastsurfer_gpu 1015 | cat <> ${KUL_apps_config} 1016 | # adding FastSurfer 1017 | export FASTSURFER_HOME="${install_location}/FastSurfer" 1018 | export PATH=\$FASTSURFER_HOME:\$PATH 1019 | export PATH=\$FASTSURFER_HOME/recon_surf:\$PATH 1020 | export PYTHONPATH="\${PYTHONPATH}:\$PWD" 1021 | 1022 | EOT 1023 | echo "echo -e \"\t FastSurfer\t-\t\$(cd $KUL_apps_DIR/FastSurfer; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 1024 | else 1025 | echo "ok - you choose not to install FastSurfer" 1026 | fi 1027 | elif [ $local_os -eq 1 ]; then 1028 | echo "On macOS we will use the docker version of Fastsurfer" 1029 | else 1030 | echo "Already installed FastSurfer" 1031 | fi 1032 | 1033 | 1034 | # Installation of Karawun 1035 | if ! [ -f "${install_location}/.KUL_apps_installed_karawun" ]; then 1036 | install_KUL_apps "Karawun" 1037 | if [ $do_not_install -eq 0 ]; then 1038 | conda config --append channels conda-forge --append channels anaconda --append channels SimpleITK 1039 | conda create --name KarawunEnv python=3.8 karawun 1040 | touch ${install_location}/.KUL_apps_installed_karawun 1041 | else 1042 | echo "ok - you choose not to install Karawun" 1043 | fi 1044 | else 1045 | echo "Already installed Karawun" 1046 | fi 1047 | 1048 | 1049 | # complete the config file to be sourced by ${bashfile} 1050 | KULcheck=${install_location}/.KUL_apps_installed_prompts 1051 | if [ ! -f ${KULcheck} ]; then 1052 | # the KUL_apps_config 1053 | echo "# Welcome to KUL_Apps" >> ${KUL_apps_config} 1054 | echo "echo \"Welcome to KUL_Apps\" " >> ${KUL_apps_config} 1055 | echo "echo \" installation DIR is ${install_location}\" " >> ${KUL_apps_config} 1056 | echo "echo \" the config file is ${KUL_apps_config}\" " >> ${KUL_apps_config} 1057 | echo "echo \" installed software/version is: \"" >> ${KUL_apps_config} 1058 | echo "source $KUL_apps_versions" >> ${KUL_apps_config} 1059 | echo "echo \" \" " >> ${KUL_apps_config} 1060 | touch $KULcheck 1061 | fi 1062 | 1063 | echo -e "\n\n\n" 1064 | echo "All done. Please exit all terminals." 1065 | echo "Install the Freesurfer license.txt into ${install_location}/freesurfer_license/" 1066 | -------------------------------------------------------------------------------- /old/KUL_Install_NeuroImagingSoftware.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script installs many NeuroImaging software for use in 4 | # MRI neuroimaging on Linux, WSL2 or macOS... 5 | # Stefan Sunaert - first version dd 08092020 - v0.1 6 | # current version dd 21062023 - v0.9 7 | 8 | # ask each time to install a program 9 | if [ ! -z $1 ]; then 10 | if [ $1 = "auto" ]; then 11 | auto=1 12 | fi 13 | else 14 | auto=0 15 | fi 16 | 17 | # do you want to install cuda (only for an nvidia GPU) 18 | install_cuda=1 19 | 20 | 21 | # Define the install location 22 | install_location=/usr/local/KUL_apps 23 | KUL_apps_config="${install_location}/KUL_apps_config" 24 | KUL_apps_versions="${install_location}/KUL_apps_versions" 25 | 26 | 27 | # check the operating system 28 | # 1 for macOS 29 | # 2 for WSL2 30 | # 3 for Ubuntu 31 | if [[ $(uname | grep Darwin) ]];then 32 | local_os=1 33 | os_name="macOS" 34 | bashfile=$HOME/.bash_profile 35 | elif [[ $(grep microsoft /proc/version) ]]; then 36 | local_os=2 37 | os_name="Windows-WSL2" 38 | bashfile=$HOME/.bashrc 39 | else 40 | local_os=3 41 | os_name="Linux" 42 | bashfile=$HOME/.bashrc 43 | fi 44 | echo "This script will install a lot of neuro-imaging software on ${os_name}" 45 | 46 | 47 | # Define functions to keep installation of things tidy 48 | function install_KUL_apps { 49 | cd ${install_location} 50 | source $bashfile 51 | echo -e "\n" 52 | do_not_install=0 53 | if [ $auto -eq 0 ]; then 54 | read -r -p "Proceed with the installation of $1? [Y/n] " prompt 55 | prompt=${prompt:-y} 56 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then 57 | echo 'OK we continue' 58 | else 59 | do_not_install=1 60 | fi 61 | fi 62 | } 63 | 64 | 65 | # Give some information & ask permission to continue (if not yet done so) 66 | if [ ! -f $HOME/.KUL_apps_install_yes ]; then 67 | echo " for details see https://github.com/treanus/KUL_Linux_Installation" 68 | echo " it will take several hours to install (and compile, if needed) all software." 69 | echo " You may have to exit the shell several times, after which you have to restart the script." 70 | echo " The script will check what has already been installed and continue installing software" 71 | echo " This script may ask you a several times for your password in order to install software (sudo usage)" 72 | read -r -p "Proceed with the installation? [Y/n] " prompt 73 | prompt=${prompt:-y} 74 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then 75 | echo 'OK we continue' 76 | touch $HOME/.KUL_apps_install_yes 77 | else 78 | exit 79 | fi 80 | fi 81 | 82 | 83 | # Check if users have installed dependancies for WSL2 84 | if [ $local_os -eq 2 ] && [ ! -f $HOME/.KUL_apps_install_wsl2_yes ]; then 85 | echo -e "\n" 86 | echo "You are running WSL" 87 | echo " this script only works well on WSL2 in win11 (or latest preview win10)" 88 | echo " be sure to INSTALL FIRST ON WIN11: " 89 | echo " 1/ enable nvidia cuda in WSL following https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl " 90 | echo " 2/ install docker in win11 and setup wsl2 - ubuntu integration" 91 | echo " otherwise, exit the script (answer "no" below) and do this first" 92 | read -r -p "Proceed with the installation? [Y/n] " prompt 93 | prompt=${prompt:-y} 94 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] 95 | then 96 | echo 'OK we continue' 97 | touch $HOME/.KUL_apps_install_wsl2_yes 98 | else 99 | exit 100 | fi 101 | fi 102 | 103 | 104 | # ---- MAIN ---- 105 | 106 | # Now make the install directory 107 | if [ ! -f ${install_location}/.KUL_apps_make_installdir ]; then 108 | echo "Making the install directory, readable and executable for all users" 109 | echo " you might have to give your password (if needed)" 110 | sleep 3 111 | # Determine group id 112 | kul_group=$(id -g) 113 | #echo $kul_group 114 | sudo mkdir -p ${install_location} 115 | sudo chgrp -R ${kul_group} ${install_location} 116 | sudo chmod -R 770 ${install_location} 117 | touch ${install_location}/.KUL_apps_make_installdir 118 | fi 119 | 120 | 121 | # Install requirements - TODO: check what is *really* needed! 122 | if [ ! -f ${install_location}/.KUL_apps_install_required_yes ]; then 123 | 124 | # LINUX AND WSL2 125 | if [ $local_os -gt 1 ]; then 126 | echo -e "\n" 127 | echo "We first install a number of needed packages" 128 | echo 'The system will now ask for your password (if needed) to update and upgrade all linux system software' 129 | sleep 4 130 | sudo apt update 131 | sudo apt upgrade 132 | # sudo apt -y install \ 133 | # git \ 134 | # htop \ 135 | # libgl1-mesa-glx \ 136 | # libegl1-mesa \ 137 | # libxrandr2 \ 138 | # libxss1 \ 139 | # libxcursor1 \ 140 | # libxcomposite1 \ 141 | # libasound2 \ 142 | # libxi6 \ 143 | # libxtst6 \ 144 | # g++ \ 145 | # freeglut3-dev \ 146 | # build-essential \ 147 | # libx11-dev \ 148 | # zlib1g-dev \ 149 | # libxmu-dev \ 150 | # libxi-dev \ 151 | # libglu1-mesa \ 152 | # libglu1-mesa-dev \ 153 | # libfreeimage-dev \ 154 | # libeigen3-dev \ 155 | # libqt5opengl5-dev \ 156 | # libqt5svg5-dev \ 157 | # libgl1-mesa-dev \ 158 | # libfftw3-dev \ 159 | # libtiff5-dev \ 160 | # libpng-dev \ 161 | # python3-distutils \ 162 | # tcsh \ 163 | # cmake \ 164 | # pkg-config \ 165 | # libncurses5-dev \ 166 | # libncursesw5-dev \ 167 | # libblas-dev \ 168 | # liblapack-dev \ 169 | # libopenblas0 \ 170 | # dc \ 171 | # mesa-utils \ 172 | # gedit \ 173 | # pulseaudio \ 174 | # libquadmath0 \ 175 | # libgtk2.0-0 \ 176 | # mmv \ 177 | # glances \ 178 | # numlockx \ 179 | # glibc-source 180 | 181 | sudo apt -y install \ 182 | git \ 183 | htop \ 184 | build-essential \ 185 | mmv \ 186 | numlockx \ 187 | g++ \ 188 | libeigen3-dev \ 189 | zlib1g-dev libqt5opengl5-dev libqt5svg5-dev libgl1-mesa-dev \ 190 | libfftw3-dev libtiff5-dev libpng-dev \ 191 | cmake pkg-config \ 192 | nvtop \ 193 | tcsh \ 194 | imagemagick 195 | 196 | 197 | if [ $local_os -eq 2 ];then 198 | sudo apt -y install nautilus 199 | fi 200 | touch ${install_location}/.KUL_apps_install_required_yes 201 | 202 | 203 | # macOS 204 | elif [ $local_os -eq 1 ]; then 205 | 206 | # Install command line developer tools 207 | if xcode-select --install 2>&1 | grep installed; then 208 | echo "Already installed command line developer tools - ignore the warning/error" 209 | else 210 | echo -e "\n\n\n" 211 | echo "Installing command line developer tools" 212 | sleep 3 213 | xcode-select --install 214 | fi 215 | 216 | # Check for Homebrew, install if we don't have it 217 | if ! command -v brew &> /dev/null; then 218 | echo -e "\n\n\n" 219 | echo "Installing brew" 220 | sleep 3 221 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 222 | fi 223 | 224 | # Update homebrew recipes 225 | brew update 226 | 227 | # install a number of brew packages 228 | echo -e "\n\n\n" 229 | echo "Installing packages..." 230 | echo " you may see errors or warnings if packages are already installed" 231 | sleep 3 232 | brew install git 233 | brew install hub 234 | brew install jq 235 | brew install wget 236 | brew install eigen 237 | brew install qt 238 | brew install pkg-config 239 | brew install libtiff 240 | brew install fftw 241 | brew install mmv 242 | brew install cmake 243 | brew install netpbm 244 | brew install openblas 245 | brew install zlib 246 | brew install lapack 247 | brew install htop 248 | 249 | echo -e "\n\n\n" 250 | echo "Installing cask apps..." 251 | echo " you may see errors or warnings if programs are already installed" 252 | sleep 3 253 | brew install --cask visual-studio-code 254 | brew install --cask xquartz 255 | brew install --cask cyberduck 256 | brew install --cask docker 257 | brew install --cask firefox 258 | brew install --cask menumeters 259 | brew install --cask osirix-quicklook 260 | brew install --cask quicklook-json 261 | brew install --cask quicklook-csv 262 | brew install --cask itk-snap 263 | 264 | echo -e "\n\n\n" 265 | echo "KUL_Install_NeuroImagingSoftware:" 266 | echo "Now:" 267 | echo " 1/ manually setup docker (open app and set up)" 268 | echo " 2/ if you are behind a strict (hospital/university) firewall you may want to copy the line below:" 269 | echo " git config --global url."https://".insteadOf git://" 270 | echo " into another terminal and execute" 271 | echo " 3/ reboot and run the KNT_Linux_install.sh again from a new terminal" 272 | touch ${install_location}/.KUL_apps_install_required_yes 273 | exit 274 | 275 | fi 276 | fi 277 | 278 | 279 | # initiate the config file to be sourced by ${bashfile} 280 | if [ ! -f ${KUL_apps_config} ]; then 281 | # the KUL_apps_config 282 | echo "export KUL_apps_DIR="${install_location}"" > ${KUL_apps_config} 283 | # the KUL_apps_version 284 | cat < $KUL_apps_versions 285 | #!/bin/bash 286 | EOT 287 | # update ${bashfile} 288 | echo "" >> ${bashfile} 289 | echo "# Source the KUL_apps and other neuroimaging software" >> ${bashfile} 290 | echo "source ${KUL_apps_config}" >> ${bashfile} 291 | source ${bashfile} 292 | sleep 4 293 | fi 294 | 295 | 296 | # Installation of Anaconda --- BEGIN 297 | if ! command -v conda &> /dev/null; then 298 | install_KUL_apps "Anaconda3" 299 | if [ $do_not_install -eq 0 ]; then 300 | if [ $local_os -eq 1 ]; then 301 | anaconda_version=Anaconda3-2021.05-MacOSX-x86_64.pkg 302 | wget https://repo.anaconda.com/archive/${anaconda_version} 303 | sudo installer -pkg ${anaconda_version} -target ${install_location} 304 | else 305 | anaconda_version=Anaconda3-2023.03-1-Linux-x86_64.sh 306 | #sudo apt-get -y install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 307 | wget https://repo.anaconda.com/archive/${anaconda_version} 308 | echo -e "\n\n" 309 | echo "Here we give the installation instructions for anaconda..." 310 | echo "ACCEPT THE LICENSE" 311 | echo "INSTALL DIRECTORY = /usr/local/KUL_apps/anaconda3" 312 | echo "Say NO initialize Anaconda3" 313 | read -p "Press any key to continue... " -n1 -s 314 | bash ${anaconda_version} -p ${install_location}/anaconda3 315 | echo "" >> ${KUL_apps_config} 316 | echo "# load Anaconda3" 317 | 318 | # begin cat command - see below 319 | cat <> ${KUL_apps_config} 320 | # >>> conda initialize >>> 321 | # !! Contents within this block are managed by 'conda init' !! 322 | __conda_setup="\$('/usr/local/KUL_apps/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" 323 | if [ \$? -eq 0 ]; then 324 | eval "\$__conda_setup" 325 | else 326 | if [ -f "/usr/local/KUL_apps/anaconda3/etc/profile.d/conda.sh" ]; then 327 | . "/usr/local/KUL_apps/anaconda3/etc/profile.d/conda.sh" 328 | else 329 | export PATH="/usr/local/KUL_apps/anaconda3/bin:\$PATH" 330 | fi 331 | fi 332 | unset __conda_setup 333 | # <<< conda initialize <<< 334 | 335 | EOT 336 | # end cat command - see above 337 | 338 | fi 339 | 340 | rm ${anaconda_version} 341 | echo "echo -e \"\t Anaconda3\t-\t${anaconda_version}" \" >> $KUL_apps_versions 342 | echo -e "\n\n\n" 343 | echo "Now exit all ${os_name} terminals and run the KNT_Linux_install.sh again from a new terminal" 344 | 345 | exit 346 | 347 | else 348 | echo "Ananconda is really essential - don't know what to do but exit" 349 | exit 350 | fi 351 | else 352 | echo "Already installed Anaconda3" 353 | fi 354 | # Installation of Anaconda --- END 355 | 356 | 357 | # Setup some useful stuff 358 | if ! [ -f "${install_location}/.KUL_apps_useful_installed" ] 359 | then 360 | echo "Setting up useful aliases " 361 | 362 | echo "# KUL_apps - Setting up some useful stuff" >> ${KUL_apps_config} 363 | echo "alias ll='ls -alhF'" >> ${KUL_apps_config} 364 | if [ $local_os -eq 1 ];then 365 | echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ${KUL_apps_config} 366 | echo "export PATH=\$HOME/.local/bin:\$PATH" >> ${KUL_apps_config} 367 | fi 368 | if [ $local_os -eq 2 ];then 369 | echo "alias code='code &'" >> ${KUL_apps_config} 370 | fi 371 | touch ${install_location}/.KUL_apps_useful_installed 372 | else 373 | echo "Already set up useful aliases" 374 | fi 375 | 376 | # adding some more 377 | pip install py3nvml glances 378 | 379 | # install cuda toolkit 380 | if [ $local_os -eq 2 ]; then 381 | echo "Already installed cuda in win11" 382 | elif [ $local_os -eq 3 ]; then 383 | if [ $install_cuda -eq 1 ]; then 384 | if ! command -v nvcc &> /dev/null 385 | then 386 | wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb 387 | sudo dpkg -i cuda-keyring_1.1-1_all.deb 388 | sudo apt-get update 389 | sudo apt-get -y install cuda 390 | 391 | cat <> ${KUL_apps_config} 392 | # adding cuda_toolkit 393 | export PATH=/usr/local/cuda/bin\${PATH:+:\${PATH}} 394 | export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH} 395 | 396 | EOT 397 | fi 398 | else 399 | echo "Already installed cuda" 400 | fi 401 | elif [ $local_os -eq 1 ]; then 402 | echo "Not installing cuda on macOS (no nvidia cards available)" 403 | fi 404 | 405 | 406 | 407 | # Installation of Visual Studio Code 408 | if ! [ command -v code &> /dev/null ] && [ $local_os -gt 1 ]; then 409 | wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg 410 | sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/ 411 | sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' 412 | sudo apt-get -y install apt-transport-https 413 | sudo apt-get -y update 414 | sudo apt-get -y install code 415 | rm packages.microsoft.gpg 416 | else 417 | echo "Already installed Visual Studio Code" 418 | fi 419 | 420 | 421 | # Install pytorch 422 | if ! command -v torchrun &> /dev/null 423 | then 424 | conda install -y pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia 425 | else 426 | echo "Already installed pytorch" 427 | fi 428 | 429 | 430 | # Installation of HD-BET 431 | if ! command -v hd-bet &> /dev/null 432 | then 433 | install_KUL_apps "HD-BET" 434 | if [ $do_not_install -eq 0 ]; then 435 | git clone https://github.com/MIC-DKFZ/HD-BET 436 | cd HD-BET 437 | if [ $local_os -eq 1 ]; then 438 | sudo pip install -e . # sudo needed for macOS, yes 439 | else 440 | pip install -e . # ??? sudo needed for macOS, check if needed for Linux/WSL2 next time 441 | fi 442 | cd 443 | echo "echo -e \"\t HD-BET\t\t-\t\$(cd $KUL_apps_DIR/HD-BET; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 444 | if [ $local_os -eq 1 ]; then 445 | echo "" >> ${KUL_apps_config} 446 | echo "# Setting up HD-BET" >> ${KUL_apps_config} 447 | echo "alias hd-bet='hd-bet -device cpu -mode fast -tta 0 ' " >> ${KUL_apps_config} 448 | fi 449 | else 450 | echo "ok - you choose not to install HD-BET" 451 | fi 452 | else 453 | echo "Already installed HD-BET" 454 | fi 455 | 456 | 457 | # Installation of MRtrix3 458 | if ! command -v mrconvert &> /dev/null; then 459 | install_KUL_apps "MRtrix3" 460 | if [ $do_not_install -eq 0 ]; then 461 | echo "KUL_apps: which version do you want to install" 462 | echo " 1 - stable" 463 | echo " 2 - development" 464 | read -r -p "MRtrix3 version: [1/2] " mrtrix3_prompt 465 | git clone https://github.com/MRtrix3/mrtrix3.git 466 | cd mrtrix3 467 | if [[ $mrtrix3_prompt == "2" ]]; then 468 | git checkout dev 469 | fi 470 | if [ $local_os -eq 1 ];then 471 | ./configure -conda 472 | else 473 | ./configure 474 | fi 475 | ./build 476 | # begin cat command - see below 477 | cat <> ${KUL_apps_config} 478 | # adding MRTRIX3 479 | export PATH=${install_location}/mrtrix3/bin:\$PATH 480 | 481 | EOT 482 | # end cat command - see above 483 | ${install_location}/mrtrix3/install_mime_types.sh 484 | 485 | echo "echo -e \"\t mrtrix3\t-\t\$(mrconvert -version | head -1 | awk '{ print \$3 }') \"" >> $KUL_apps_versions 486 | else 487 | echo "ok - you choose not to install MRtrix3" 488 | fi 489 | else 490 | echo "Already installed MRtrix3" 491 | fi 492 | 493 | 494 | # Installation of shard-recon 495 | if ! command -v dwimotioncorrect &> /dev/null; then 496 | install_KUL_apps "shard-recon" 497 | if [ $do_not_install -eq 0 ]; then 498 | git clone https://github.com/dchristiaens/shard-recon.git 499 | cd shard-recon 500 | ln -s ${install_location}/mrtrix3/build 501 | ln -s ${install_location}/mrtrix3/bin/mrtrix3.py bin/ 502 | ./build 503 | # begin cat command - see below 504 | cat <> ${KUL_apps_config} 505 | # adding shard-recon 506 | export PATH=${install_location}/shard-recon/bin:\$PATH 507 | 508 | EOT 509 | 510 | else 511 | echo "ok - you choose not to install shard-recon" 512 | fi 513 | else 514 | echo "Already installed shard-recon" 515 | fi 516 | 517 | 518 | # Installation of FSL 519 | if ! command -v fslmaths &> /dev/null; then 520 | install_KUL_apps "FSL" 521 | if [ $do_not_install -eq 0 ]; then 522 | #if [ $local_os -eq 2 ]; then 523 | # sudo apt-get -y install dc python mesa-utils gedit pulseaudio libquadmath0 libgtk2.0-0 firefox 524 | #fi 525 | wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/fslinstaller.py 526 | #if [ $local_os -gt 1 ]; then 527 | # sudo apt-get -y install python2.7 528 | #fi 529 | echo -e "\n\n\n" 530 | echo "Here we give the installation instructions for FSL..." 531 | echo "it is ok to install to the default /usr/local/fsl directory" 532 | read -p "Press any key to continue... " -n1 -s 533 | exit 534 | python fslinstaller.py -d /usr/local/fsl -s 535 | rm fslinstaller.py 536 | cat <> ${KUL_apps_config} 537 | # Installing FSL 538 | FSLDIR=/usr/local/fsl 539 | PATH=\${FSLDIR}/share/fsl/bin:\${PATH} 540 | export FSLDIR PATH 541 | . \${FSLDIR}/etc/fslconf/fsl.sh 542 | 543 | EOT 544 | echo "echo -e \"\t FSL\t\t-\t\$(cat \$FSLDIR/etc/fslversion)\"" >> $KUL_apps_versions 545 | else 546 | echo "ok - you choose not to install FSL" 547 | fi 548 | else 549 | echo "Already installed FSL" 550 | fi 551 | 552 | 553 | 554 | # Installation of KUL_NIS (KULeuven Neuro Imaging Suite) 555 | if ! [ -d "${install_location}/KUL_NIS" ]; then 556 | install_KUL_apps "KUL_NIS" 557 | if [ $do_not_install -eq 0 ]; then 558 | git clone https://github.com/treanus/KUL_NIS.git 559 | #if [ $local_os -gt 1 ]; then 560 | #sudo apt-get install libopenblas0 561 | #cp KUL_NIS/share/eddy_cuda11.2_linux.tar.gz . 562 | #tar -xzvf eddy_cuda11.2_linux.tar.gz 563 | #rm eddy_cuda11.2_linux.tar.gz 564 | #sudo ln -s ${install_location}/eddy_cuda/eddy_cuda11.2 /usr/local/fsl/bin/eddy_cuda 565 | #fi 566 | cat <> ${KUL_apps_config} 567 | # adding KUL_NIS (KULeuven Neuro Imaging Suite) 568 | export PATH=${install_location}/KUL_NIS:\$PATH 569 | export PYTHONPATH=${install_location}/mrtrix3/lib:\$PYTHONPATH 570 | 571 | EOT 572 | echo "echo -e \"\t KUL_NIS\t-\t\$(cd $KUL_apps_DIR/KUL_NIS; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 573 | else 574 | echo "ok - you choose not to install KUL_NIS" 575 | fi 576 | else 577 | echo "Already installed KUL_NIS" 578 | fi 579 | 580 | 581 | 582 | # Installation of Docker 583 | if ! command -v docker &> /dev/null; then 584 | if [ $local_os -gt 1 ]; then 585 | install_KUL_apps "Docker" 586 | if [ $do_not_install -eq 0 ]; then 587 | for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done 588 | #sudo apt-get -y remove docker docker-engine docker.io 589 | sudo apt-get -y update 590 | sudo apt-get -y install docker.io 591 | sudo systemctl start docker 592 | sudo systemctl enable docker 593 | sudo groupadd docker 594 | sudo usermod -aG docker $USER 595 | newgrp docker 596 | 597 | # now for gpu capability 598 | #distribution=ubuntu22.04 \ 599 | # && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \ 600 | # && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \ 601 | # sudo tee /etc/apt/sources.list.d/nvidia-docker.list 602 | sudo apt-get update 603 | sudo apt-get install -y nvidia-docker2 604 | sudo systemctl restart docker 605 | 606 | else 607 | echo "ok - you choose not to install Docker - it is essential though in most cases..." 608 | fi 609 | fi 610 | else 611 | echo "Already installed Docker" 612 | fi 613 | 614 | 615 | 616 | # Installation of dcm2niix 617 | if ! command -v dcm2niix &> /dev/null; then 618 | install_KUL_apps "dcm2niix" 619 | if [ $do_not_install -eq 0 ]; then 620 | git clone https://github.com/rordenlab/dcm2niix.git 621 | cd dcm2niix 622 | mkdir build && cd build 623 | cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON .. 624 | make 625 | cat <> ${KUL_apps_config} 626 | # adding dcm2nixx 627 | export PATH=${install_location}/dcm2niix/build/bin:\$PATH 628 | 629 | EOT 630 | echo "echo -e \"\t dcm2nixx\t-\t\$(dcm2niix --version | head -1 | awk '{ print \$5 }') \"" >> $KUL_apps_versions 631 | else 632 | echo "ok - you choose not to install dcm2niix" 633 | fi 634 | else 635 | echo "Already installed dcm2niix" 636 | fi 637 | 638 | 639 | # Installation of dcm2bids 640 | if ! command -v dcm2bids &> /dev/null; then 641 | install_KUL_apps "dcm2bids" 642 | if [ $do_not_install -eq 0 ]; then 643 | conda install -y -c conda-forge dcm2bids 644 | echo "echo -e \"\t dcm2bids\t-\t\$(dcm2bids -h | grep dcm2bids | tail -1 | awk '{ print \$2 }') \"" >> $KUL_apps_versions 645 | else 646 | echo "ok - you choose not to install dcm2bids" 647 | fi 648 | else 649 | echo "Already installed dcm2bids" 650 | fi 651 | 652 | 653 | # lets's make install current 654 | source ${bashfile} 655 | 656 | # download a number of Docker containers 657 | if [ ! -f ${install_location}/.KUL_apps_install_containers_yes ]; then 658 | echo "Now installing some useful docker containers" 659 | sleep 3 660 | if [ $local_os -eq 1 ]; then 661 | echo -e "\n\n\n" 662 | echo "Here we give the installation instructions for docker containers on macOS..." 663 | echo "See to it that Docker Desktop is setup and running" 664 | read -p "Press any key to continue... " -n1 -s 665 | echo "Not installing hd-glio-auto on macOS (no compatible GPU)" 666 | echo "echo -e \"\t hd-glio-auto\t-\tcannot be installed (no compatible GPU) \"" >> $KUL_apps_versions 667 | else 668 | docker pull jenspetersen/hd-glio-auto 669 | echo "echo -e \"\t hd-glio-auto\t-\tcannot be checked (but latest docker) \"" >> $KUL_apps_versions 670 | fi 671 | else 672 | echo "Already installed required docker containers" 673 | fi 674 | 675 | 676 | 677 | # Installation of Freesurfer 678 | if ! command -v freeview &> /dev/null; then 679 | echo "KUL_apps: which version do you want to install" 680 | echo " 1 - v6.0.0 (recommended)" 681 | echo " 2 - v7.4.1" 682 | read -r -p "Freesurfer version: [1/2] " fs_prompt 683 | if [[ $fs_prompt == "2" ]]; then 684 | freesurfer_version="7.4.1" 685 | if [ $local_os -eq 1 ]; then 686 | freesurfer_file="freesurfer-macOS-darwin_x86_64-7.4.1" 687 | else 688 | freesurfer_file="freesurfer-linux-ubuntu22_amd64-7.4.1" 689 | fi 690 | else 691 | freesurfer_version="6.0.0" 692 | if [ $local_os -eq 1 ]; then 693 | freesurfer_file="freesurfer-Darwin-OSX-stable-pub-v6.0.0" 694 | else 695 | freesurfer_file="freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0" 696 | fi 697 | fi 698 | install_KUL_apps "Freesurfer v ${freesurfer_version}" 699 | if [ $do_not_install -eq 0 ]; then 700 | wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/${freesurfer_version}/${freesurfer_file}.tar.gz 701 | tar -zxvpf ${freesurfer_file}.tar.gz 702 | cat <> ${KUL_apps_config} 703 | # adding freesurfer 704 | export FREESURFER_HOME=${install_location}/freesurfer 705 | export SUBJECTS_DIR=\$FREESURFER_HOME/subjects 706 | export FS_LICENSE=\$FREESURFER_HOME/license.txt 707 | source \$FREESURFER_HOME/SetUpFreeSurfer.sh 708 | 709 | EOT 710 | 711 | echo "echo -e \"\t freesurfer\t-\t\$(recon-all -version) \"" >> $KUL_apps_versions 712 | echo "if [ ! -f \$FREESURFER_HOME/license.txt ]; then" >> ${KUL_apps_versions} 713 | echo " echo -e \"\t\t Warning: no freesufer license found in \${FREESURFER_HOME}\"" >> ${KUL_apps_versions} 714 | echo "fi" >> ${KUL_apps_versions} 715 | echo "Install the license.txt into \${FREESURFER_HOME}" 716 | rm ${freesurfer_file}.tar.gz 717 | else 718 | echo "ok - you choose not to install Freesurfer" 719 | fi 720 | else 721 | echo "Already installed Freesurfer ${freesurfer_version}" 722 | fi 723 | 724 | 725 | 726 | # Installation of Ants 727 | if ! [ -d "${install_location}/ANTs_installed" ]; then 728 | install_KUL_apps "Ants" 729 | if [ $do_not_install -eq 0 ]; then 730 | wget https://raw.githubusercontent.com/cookpa/antsInstallExample/master/installANTs.sh 731 | chmod +x installANTs.sh 732 | #if [ $local_os -gt 1 ]; then 733 | # sudo apt-get -y install cmake pkg-config 734 | #fi 735 | ./installANTs.sh 736 | mv install ANTs_installed 737 | rm installANTs.sh 738 | rm -rf build 739 | cd 740 | cat <> ${KUL_apps_config} 741 | # adding ANTs 742 | export ANTSPATH=${install_location}/ANTs_installed/bin/ 743 | export PATH=\${ANTSPATH}:\$PATH 744 | 745 | EOT 746 | echo "echo -e \"\t ants\t\t-\t\$(antsRegistration --version | head -1 | awk '{ print \$3 }') \"" >> $KUL_apps_versions 747 | else 748 | echo "ok - you choose not to install Ants" 749 | fi 750 | else 751 | echo "Already installed ANTs" 752 | fi 753 | 754 | 755 | # Installation of DCMTK 756 | if ! command -v storescu &> /dev/null; then 757 | install_KUL_apps "DCMTK" 758 | if [ $do_not_install -eq 0 ]; then 759 | if [ $local_os -eq 1 ]; then 760 | brew install dcmtk 761 | else 762 | sudo apt-get -y install dcmtk 763 | fi 764 | else 765 | echo "ok - you choose not to install DCMTK" 766 | fi 767 | else 768 | echo "Already installed DCMTK" 769 | fi 770 | 771 | 772 | # Installation of GDCM (other dicom tools) 773 | if ! command -v gdcmtar &> /dev/null; then 774 | install_KUL_apps "GDCM" 775 | if [ $do_not_install -eq 0 ]; then 776 | if [ $local_os -eq 1 ]; then 777 | brew install gdcm 778 | else 779 | sudo apt-get -y install libgdcm-tools 780 | fi 781 | else 782 | echo "ok - you choose not to install GDCM" 783 | fi 784 | else 785 | echo "Already installed GDCM" 786 | fi 787 | 788 | 789 | # Setup of Matlab 790 | #if ! command -v matlab &> /dev/null 791 | #then 792 | # echo "" >> ${bashfile} 793 | # echo "# adding matlab" >> ${bashfile} 794 | # echo "export PATH=/usr/local/MATLAB/R2018a/bin:\$PATH" >> ${bashfile} 795 | # echo "alias matlab='xrandr --dpi 144; matlab &'" >> ${bashfile} 796 | #fi 797 | 798 | 799 | # Installation of SPM12 800 | if ! [ -d "${install_location}/spm12" ]; then 801 | install_KUL_apps "spm12" 802 | if [ $do_not_install -eq 0 ]; then 803 | wget https://www.fil.ion.ucl.ac.uk/spm/download/restricted/eldorado/spm12.zip 804 | unzip spm12.zip 805 | #Note: Matlab needs to be installed first to compile the mex files 806 | read -r -p "Do you want to recompile to SPM binaries (if so, you need yo have matlab installed and set up) [y/n] " prompt 807 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] 808 | then 809 | echo 'OK we continue' 810 | cd spm12/src 811 | make distclean 812 | make && make install 813 | make external-distclean 814 | make external && make external-install 815 | cd ${install_location} 816 | fi 817 | rm spm12.zip 818 | echo "echo -e \"\t spm12\t\t-\tcheck from within matlab please \"" >> $KUL_apps_versions 819 | else 820 | echo "ok - you choose not to install spm12. Do not install cat12, lead-dbs and conn since it depends on it" 821 | fi 822 | else 823 | echo "Already installed spm12" 824 | fi 825 | 826 | 827 | # Installation of cat12 828 | if ! [ -d "${install_location}/spm12/toolbox/cat12" ]; then 829 | install_KUL_apps "cat12" 830 | if [ $do_not_install -eq 0 ]; then 831 | wget http://www.neuro.uni-jena.de/cat12/cat12_latest.zip 832 | unzip cat12_latest.zip -d spm12/toolbox 833 | rm cat12_latest.zip 834 | echo "echo -e \"\t cat12\t\t-\tcheck from within matlab please \"" >> $KUL_apps_versions 835 | else 836 | echo "ok - you choose not to install cat12" 837 | fi 838 | else 839 | echo "Already installed cat12" 840 | fi 841 | 842 | 843 | # Installation of Lead-DBS 844 | if ! [ -d "${install_location}/leaddbs" ]; then 845 | install_KUL_apps "Lead-DBS" 846 | if [ $do_not_install -eq 0 ]; then 847 | git clone https://github.com/netstim/leaddbs.git 848 | wget -O leaddbs_data.zip http://www.lead-dbs.org/release/download.php?id=data_pcloud 849 | echo -e "\n\n\n" 850 | echo "Here we give the installation instructions for Lead-dbs..." 851 | echo "answer yes when asked to replace templates" 852 | read -p "Press any key to continue... " -n1 -s 853 | unzip leaddbs_data.zip -d leaddbs/ 854 | rm leaddbs_data.zip 855 | echo "echo -e \"\t Lead-DBS\t-\tcheck from within matlab please \"" >> $KUL_apps_versions 856 | else 857 | echo "ok - you choose not to install Lead-DBS" 858 | fi 859 | else 860 | echo "Already installed Lead-DBS" 861 | fi 862 | 863 | 864 | # Installation of CONN 865 | conn_version="con22a" 866 | if ! [ -d "${install_location}/${conn_version}" ]; then 867 | install_KUL_apps "conn-toolbox version ${conn_version}" 868 | if [ $do_not_install -eq 0 ]; then 869 | wget https://www.nitrc.org/frs/download.php/11714/${conn_version}.zip 870 | unzip ${conn_version}.zip 871 | mv conn ${conn_version} 872 | rm ${conn_version}.zip 873 | echo "echo -e \"\t conn\t\t-\t${conn_version} \"" >> $KUL_apps_versions 874 | else 875 | echo "ok - you choose not to install ${conn_version}" 876 | fi 877 | else 878 | echo "Already installed conn-toolbox version ${conn_version}" 879 | fi 880 | 881 | 882 | # Installation of VBG 883 | if ! [ -d "${install_location}/KUL_VBG" ]; then 884 | install_KUL_apps "KUL_VBG" 885 | if [ $do_not_install -eq 0 ]; then 886 | git clone https://github.com/treanus/KUL_VBG.git 887 | cat <> ${KUL_apps_config} 888 | # adding KUL_VBG 889 | export PATH=${install_location}/KUL_VBG:\$PATH 890 | 891 | EOT 892 | echo "echo -e \"\t KUL_VBG\t-\t\$(cd $KUL_apps_DIR/KUL_VBG; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 893 | else 894 | echo "ok - you choose not to install KUL_VBG" 895 | fi 896 | else 897 | echo "Already installed KUL_VBG" 898 | fi 899 | 900 | 901 | # Installation of FWT 902 | if ! [ -d "${install_location}/KUL_FWT" ] 903 | then 904 | install_KUL_apps "KUL_FWT" 905 | if [ $do_not_install -eq 0 ]; then 906 | git clone https://github.com/treanus/KUL_FWT.git 907 | cd KUL_FWT 908 | git checkout dev 909 | cd .. 910 | cat <> ${KUL_apps_config} 911 | # adding KUL_FWT 912 | export PATH="${install_location}/KUL_FWT:\$PATH" 913 | 914 | EOT 915 | echo "echo -e \"\t KUL_FWT\t-\t\$(cd $KUL_apps_DIR/KUL_FWT; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 916 | else 917 | echo "ok - you choose not to install KUL_FWT" 918 | fi 919 | else 920 | echo "Already installed KUL_FWT" 921 | fi 922 | 923 | # Installation of our fork of Synb0 924 | if ! [ -d "${install_location}/Synb0-DISCO" ] 925 | then 926 | install_KUL_apps "Synb0-DISCO" 927 | if [ $do_not_install -eq 0 ]; then 928 | git clone https://github.com/Rad-dude/Synb0-DISCO.git 929 | conda create --name radsyndisco python=3.8 930 | conda activate radsyndisco 931 | #sudo apt install python3-pip 932 | #pip install torch 933 | #pip install torchvision 934 | #pip install numpy scipy matplotlib ipython jupyter pandas sympy nose 935 | conda install astunparse numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses 936 | #pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html 937 | #pip install 'nibabel==2.5.2' 938 | pip install nibabel scipy 939 | conda deactivate 940 | cat <> ${KUL_apps_config} 941 | # adding SynbO-DISCO 942 | export PATH="${install_location}/Synb0-DISCO/data_processing:\$PATH" 943 | 944 | EOT 945 | echo "echo -e \"\t Synbo-DISCO\t-\t\$(cd $KUL_apps_DIR/Synb0-DISCO; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 946 | else 947 | echo "ok - you choose not to install Synb0-DISCO" 948 | fi 949 | else 950 | echo "Already installed Synb0-DISCO" 951 | fi 952 | 953 | 954 | # Installation of Scilpy 955 | if ! command -v scil_filter_tractogram.py &> /dev/null; then 956 | install_KUL_apps "Scilpy" 957 | if [ $do_not_install -eq 0 ]; then 958 | #if [ $local_os -gt 1 ]; then 959 | # sudo apt-get -y install libblas-dev liblapack-dev 960 | #fi 961 | sudo apt install libblas-dev liblapack-dev libfreetype6-dev 962 | git clone https://github.com/scilus/scilpy.git 963 | cd scilpy 964 | conda create --name scilpy python=3.10 965 | conda activate scilpy 966 | pip install -e . 967 | conda deactivate 968 | echo "echo -e \"\t scilpy\t\t-\t\$(cd $KUL_apps_DIR/scilpy; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 969 | else 970 | echo "ok - you choose not to install Scilpy" 971 | fi 972 | else 973 | echo "Already installed Scilpy" 974 | fi 975 | 976 | 977 | # Installation of FastSurfer 978 | if ! [ -d "${install_location}/FastSurfer/" ] && [ $local_os -gt 1 ]; then 979 | install_KUL_apps "FastSurfer" 980 | if [ $do_not_install -eq 0 ]; then 981 | git clone https://github.com/Deep-MI/FastSurfer.git 982 | cat <> ${KUL_apps_config} 983 | # adding FastSurfer 984 | export FASTSURFER_HOME="${install_location}/FastSurfer" 985 | export PATH=\$FASTSURFER_HOME:\$PATH 986 | export PATH=\$FASTSURFER_HOME/recon_surf:\$PATH 987 | 988 | EOT 989 | source ${install_location}/KUL_apps_config 990 | echo "echo -e \"\t FastSurfer\t-\t\$(cd $KUL_apps_DIR/FastSurfer; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 991 | else 992 | echo "ok - you choose not to install FastSurfer" 993 | fi 994 | elif [ $local_os -eq 1 ]; then 995 | echo "On macOS we will use the docker version of Fastsurfer" 996 | else 997 | echo "Already installed FastSurfer" 998 | fi 999 | 1000 | # Installation of Karawun 1001 | if ! [ -f "${install_location}/.KUL_apps_installed_karawun" ]; then 1002 | install_KUL_apps "Karawun" 1003 | if [ $do_not_install -eq 0 ]; then 1004 | #sudo chown -R "$(id -u):$(id -g)" $HOME/.conda 1005 | conda config --append channels conda-forge --append channels anaconda --append channels SimpleITK 1006 | conda create --name KarawunEnv python=3.8 karawun 1007 | #conda install -y git 1008 | #conda create --name KarawunEnv --file https://github.com/DevelopmentalImagingMCRI/karawun/raw/master/requirements.txt 1009 | #conda activate KarawunEnv 1010 | #pip install git+https://github.com/DevelopmentalImagingMCRI/karawun.git@master 1011 | #conda deactivate 1012 | touch ${install_location}/.KUL_apps_installed_karawun 1013 | else 1014 | echo "ok - you choose not to install Karawun" 1015 | fi 1016 | else 1017 | echo "Already installed Karawun" 1018 | fi 1019 | 1020 | 1021 | # Installation of Mevislab 3.7 1022 | if ! [ -f "${install_location}/.KUL_apps_installed_mevislab" ]; then 1023 | install_KUL_apps "Mevislab 3.7" 1024 | if [ $do_not_install -eq 0 ]; then 1025 | if [ $local_os -eq 1 ]; then 1026 | 1027 | ml_file="https://mevislabdownloads.mevis.de/Download/MeVisLab3.4.2/Mac/X86-64/MeVisLabSDK3.4.2_x86-64.dm" 1028 | wget $ml_file 1029 | hdiutil mount $ml_file 1030 | sudo cp -R /Volumes/MeVisLabSDK/MeVisLab.app /Applications 1031 | hdiutil unmount /Volumes/MeVisLabSDK 1032 | rm $ml_file 1033 | else 1034 | sudo apt-get install libxcb-xinput0 libxcb-xinerama0 1035 | wget https://mevislabdownloads.mevis.de/Download/MeVisLab3.7.0/Linux/GCC11-64/MeVisLabSDK3.7.0_gcc11-64.bin 1036 | chmod u+x MeVisLabSDK3.7.0_gcc11-64.bin 1037 | mkdir MeVisLabSDK3.7 1038 | ./MeVisLabSDK3.7.0_gcc11-64.bin --prefix ${install_location}/MevislabSDK3.7 --mode silent 1039 | rm MeVisLabSDK3.7.0_gcc11-64.bin 1040 | fi 1041 | touch ${install_location}/.KUL_apps_installed_mevislab 1042 | else 1043 | echo "ok - you choose not to install Mevislab 3.7" 1044 | fi 1045 | else 1046 | echo "Already installed MevislabSDK3.5" 1047 | fi 1048 | 1049 | 1050 | 1051 | # Installation of Robex 1052 | if ! [ -d "${install_location}/ROBEX/" ] && [ $local_os -gt 1 ]; then 1053 | install_KUL_apps "ROBEX" 1054 | if [ $do_not_install -eq 0 ]; then 1055 | wget -qO- "https://www.nitrc.org/frs/download.php/5994/ROBEXv12.linux64.tar.gz//?i_agree=1&download_now=1" | \ 1056 | tar zx -C ${install_location} 1057 | cat <> ${KUL_apps_config} 1058 | # adding ROBEX 1059 | export PATH="${install_location}/ROBEX:\$PATH" 1060 | 1061 | EOT 1062 | else 1063 | echo "ok - you choose not to install Robex" 1064 | fi 1065 | elif [ $local_os -eq 1 ]; then 1066 | echo "Not installing Robex on macOS" 1067 | else 1068 | echo "Already installed ROBEX" 1069 | fi 1070 | 1071 | 1072 | # Installation of Spinal Cord Toolbox 1073 | program="spinalcordtoolbox" 1074 | if ! [ -d "${install_location}/${program}" ]; then 1075 | install_KUL_apps ${program} 1076 | if [ $do_not_install -eq 0 ]; then 1077 | git clone https://github.com/spinalcordtoolbox/spinalcordtoolbox 1078 | cd spinalcordtoolbox 1079 | ./install_sct 1080 | echo "echo -e \"\t spinalcord-tb\t-\t\$(cd $KUL_apps_DIR/spinalcordtoolbox; git fetch 2>&1 > /dev/null; git status | head -2 | tail -1)\"" >> $KUL_apps_versions 1081 | else 1082 | echo "ok - you choose not to install ${program}" 1083 | fi 1084 | else 1085 | echo "Already installed ${program}" 1086 | fi 1087 | 1088 | 1089 | # complete the config file to be sourced by ${bashfile} 1090 | KULcheck=${install_location}/.KUL_apps_installed_prompts 1091 | if [ ! -f ${KULcheck} ]; then 1092 | # the KUL_apps_config 1093 | echo "# Welcome to KUL_Apps" >> ${KUL_apps_config} 1094 | echo "echo \"Welcome to KUL_Apps\" " >> ${KUL_apps_config} 1095 | echo "echo \" installation DIR is ${install_location}\" " >> ${KUL_apps_config} 1096 | echo "echo \" the config file is ${KUL_apps_config}\" " >> ${KUL_apps_config} 1097 | echo "echo \" installed software/version is: \"" >> ${KUL_apps_config} 1098 | echo "source $KUL_apps_versions" >> ${KUL_apps_config} 1099 | echo "echo \" \" " >> ${KUL_apps_config} 1100 | touch $KULcheck 1101 | fi 1102 | 1103 | echo -e "\n\n\n" 1104 | echo "All done. Please reboot." 1105 | echo "Install the Freesurfer license.txt into ${install_location}/freesurfer_license/" 1106 | --------------------------------------------------------------------------------