1 System Requirements

The functionality of some of these packages requires Linux, Mac OSX, or a Unix-type system. This excludes Windows in some cases. The code was run on Linux and Mac OSX. Although we do not currently support it, Windows 10 has a Linux subsystem, which may allow for a working installation of all the dependencies of Neuroconductor.

Although still untested there is a good tutorial on running FSL on Windows as well as ANTsR on Windows.

1.1 Install R

You can install the latest R from http://cran.r-project.org/.

We also recommend installing the RStudio IDE

1.2 CMake and Git

These are required by the ANTsR suite of tools. To install these, see the relevant sections in the Installing ANTsR tutorial

1.3 FSL

See the installation instructions for FSL from https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation.

1.3.1 Neurodebian

The following was done to make the Neurodebian installation look like that of Mac OSX:

##########################################
# FSL
##########################################
sudo apt-get update \
    && sudo apt-get install -y fsl-complete

# Debian has a fixed FSLDIR
export FSLDIR=/usr/local/fsl
export FSLSHARE=/usr/share/data
# add the fsl binary path to the search path
export PATH=$PATH:${FSLDIR}/bin
# export PATH=$PATH:/usr/lib/fsl/5.0
# Possum is installed in the same directory
export POSSUMDIR=$FSLDIR

sudo mkdir -p ${FSLDIR}/bin
sudo cp /usr/lib/fsl/5.0/* ${FSLDIR}/bin/
sudo mkdir -p ${FSLDIR}/lib
sudo mv ${FSLDIR}/bin/lib* ${FSLDIR}/lib/

export FSLOUTPUTTYPE=NIFTI_GZ
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/fsl/5.0
export LD_LIBRARY_PATH=${FSLDIR}/lib/:$LD_LIBRARY_PATH:

# sudo cp /usr/share/fsl/5.0/etc/fslconf/fsl.sh $FSLDIR/etc/fslconf/fsl.sh
export FSLOUTPUTTYPE=NIFTI_GZ
# sudo rm $FSLDIR/etc/fslconf/fsl.sh
sudo mkdir -p $FSLDIR/etc/fslconf/
fname=${FSLDIR}/etc/fslconf/fsl.sh
echo "FSLDIR=/usr/local/fsl" > ${fname}
echo 'PATH=${PATH}:${FSLDIR}/bin' >> ${fname}
echo 'LD_LIBRARY_PATH=${FSLDIR}/lib:$LD_LIBRARY_PATH' >> ${fname}
echo "FSLOUTPUTTYPE=NIFTI_GZ" >> ${fname}

##########################
# Setting global library
##########################
sudo echo "${FSLDIR}/lib" > /etc/ld.so.conf.d/fsl.conf
sudo ldconfig

sudo mkdir -p ${FSLDIR}/data/standard
sudo mkdir -p ${FSLDIR}/data/atlases 

#######################################
# Setting things up like other installers
#######################################
# settring up standard
sudo cp -R ${FSLSHARE}/fsl-mni152-templates/* ${FSLDIR}/data/standard/

# setting up atlases
sudo cp -R ${FSLSHARE}/harvard-oxford-atlases/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/juelich-histological-atlas/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/bangor-cerebellar-atlas/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/jhu-dti-whitematter-atlas/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/forstmann-subthalamic-nucleus-atlas/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/fsl-resting-connectivity-parcellation-atlases/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/mni-structural-atlas/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/oxford-thalamic-connectivity-atlas/* ${FSLDIR}/data/atlases/
sudo cp -R ${FSLSHARE}/talairach-daemon-atlas/* ${FSLDIR}/data/atlases/ 

2 R Packages

2.1 Devtools Package

The tutorial and breakdown for installing the devtools package is located at: https://www.rstudio.com/products/rpackages/devtools/. Please read through it as most of the code below requires devtools.

2.2 Bioconductor

We need Bioconductor packages in some cases and we can install it with the code below:

# Installing Bioconductor
library(utils); 
source("http://bioconductor.org/biocLite.R"); 
biocLite(pkgs = c("Biobase"), suppressUpdates = TRUE, suppressAutoUpdate = TRUE, ask = FALSE)

2.3 RGL

2.4 Mac and Linux

The rgl package cand be installed using install.packages usually.

2.5 Linux

The install.packages command may have some problems on Linux machines. It can be installed in bash using:

sudo apt-get -y update && sudo apt-get build-dep -y r-cran-rgl 

There may be an error that may be mitigated by the following command in bash:

sudo sed -i -- 's/#deb-src/deb-src/g' /etc/apt/sources.list && sudo sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list

and re-running the code above.

2.6 Neuroimaging packages on Github

2.6.1 Standard Packages

source("https://neuroconductor.org/neurocLite.R")
# DICOM converter
neuro_install("dcm2niir")
library(dcm2niir); install_dcm2nii()
# HCP database connector
neuro_install("neurohcp")
# dcm2nii Rcpp implementation
neuro_install(c("RNifti", "divest", "oro.dicom", "oro.nifti", "WhiteStripe"))
# data for whitestripe
library(WhiteStripe); download_img_data()

# neurobase package
neuro_install("neurobase")
neuro_install("fslr")

2.6.2 ANTsR

Please see the the Installing ANTsR tutorial if anything errors here:

##########################################
# ANTs
##########################################
neuro_install("ITKR")
neuro_install("ANTsRCore", upgrade_dependencies = FALSE)
neuro_install("ANTsR", upgrade_dependencies = FALSE)
neuro_install("extrantsr", upgrade_dependencies = FALSE)

2.6.3 Knitting using RStudio

install.packages(c("formatR", "caTools", "rprojroot", "rmarkdown"))

2.6.4 Imaging Packages and Data

The only package that isn’t directly available is the ms.lesion package, which is due to restrictions on the data. This should be available from the tutorial

##############################
# Install MS LESION DATA!
# INSTALL KIRBY21
##############################
neuro_install("papayar")
neuro_install("oasis")
neuro_install("malf.templates")
neuro_install("kirby21.t1")

3 Conclusion

If all of these install correctly, restart R and test:

3.1 Working installation of FSL and fslr test

library(fslr)
have_fsl()
example("fsl_smooth")

3.2 Working installation of ANTsR and extrantsr

library(extrantsr)
example("smooth_image")