forked from muschellij2/Neurohacking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Installation.Rmd
240 lines (168 loc) · 8.06 KB
/
Installation.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
---
title: "Installing Neurohacking on a Local Machine"
author: "John Muschelli"
date: "August 29, 2016"
output:
html_document:
theme: cosmo
toc: true
toc_depth: 2
toc_float:
collapsed: false
---
# Preface
The course is designed for minimal system requirements or installation knowledge. We highly encourage users to install the [VirtualBox](https://www.smart-stats-tools.org/mooc-2015). If these commands do not work, please indicate on the discussion forums. Also, please indicate other strategies you have tried before posting/where you have looked (such as StackOverflow links).
# Windows Setup
FSL will not install on a Windows machine, and the developers of FSL recommend a virtual machine to their users: [http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/Windows](http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/Windows).
# Mac OSX Setup
## Installing Xcode
In order to install packages with compilation in `R`, you must install `Xcode`. For example, if you get the error: "Error: Could not find build tools necessary to build" for a package, please see [this StackOverflow Post](http://stackoverflow.com/questions/35096233/error-could-not-find-build-tools-necessary-to-build-dplyr) for a discussion and [Xcode from Apple](https://developer.apple.com/downloads/).
## Installing Git and CMake
You need `cmake` and `git` to install `ITKR`. Go to a `Terminal` (using spotlight or from `/Applications/Utilities/Terminal`) and type
```
which cmake
which git
```
### Installing Git
If nothing comes up for `git`, please see [https://www.atlassian.com/git/tutorials/install-git/mac-os-x](https://www.atlassian.com/git/tutorials/install-git/mac-os-x) to install `git`.
### Installing CMake
CMake can be installed from [https://cmake.org/download/](https://cmake.org/download/) .
#### Installing CMake from Mac DMG (recommended)
If you download the CMake dmg, you must add the cmake to your PATH, by adding:
```
PATH=$PATH:/Applications/CMake.app/Contents/bin/
export PATH
```
the the end of your `~/.bash_profile` file on your machine.
You can edit `~/.bash_profile` by opening a `Terminal` (again `/Applications/Utilities/Terminal`) and typing:
```
vi ~/.bash_profile
```
Type the letter `i` so that the bottom says `INSERT`, go to the bottom, and paste the command from above with `PATH`. When this is done, type `Esc + : + wq`. So that it says `:wq` at the bottom (stands for `w`rite out the file again, and then `q`uit).
#### Installing CMake from Source
You can also build Cmake from source:
Download using: [https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz](https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz) (or the latest on their website). Double click the `.tar.gz` file to unzip it.
The README.rst file are instructions on how to build cmake. If you open a `Terminal` (again `/Applications/Utilities/Terminal`), change directories into the directory you unzipped the `.tar.gz`, usually by:
```
cd ~/Downloads/cmake-3.6.1
```
and then run the following command:
```
./bootstrap && make && sudo make install
```
and type your password.
# Linux Setup
## Installing Git and CMake
You need `cmake` and `git` to install `ITKR`. Go to a `Terminal` and type
```
which cmake
which git
```
to see if `git` and `cmake` are installed.
### Apt-get/Ubuntu/Debian
```
sudo apt-get install cmake
sudo apt-get install git-all
```
### Yum/Centos/RedHat
```
sudo yum install cmake
sudo yum install git-all
```
## `fslr` setup
### RStudio vs. Terminal
If you run `R` from the command line/Terminal then `FSLDIR` should be set when you installed `FSL` and you should be able to run `fslr` out of the box.
If you are using `RStudio` or an `R` GUI, then you may have to make some changes to your directories for `fslr` to work.
### Neurodebian `fslr` Setup
If you install `FSL` (version 5.0) using Neurodebian, the following script should copy the necessary data/binaries to a path where `fslr` can find them.
```{bash, eval = FALSE}
FSLDIR=/usr/local/fsl
FSLSHARE=/usr/share/data
PATH=$PATH:${FSLDIR}/bin
sudo mkdir -p ${FSLDIR}/bin
sudo cp /usr/lib/fsl/5.0/* ${FSLDIR}/bin/
sudo mkdir -p ${FSLDIR}/data/standard
sudo mkdir -p ${FSLDIR}/data/atlases
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/
```
### Standard FSL installation Setup
If `FSL` was installed using the install scripts from the FSL website, then all files necessary should be located in `/usr/local/fsl`, and `fslr` should work out of the box.
# Installing R Packages
## Installing Packages from CRAN
The `oro.nifti`, `oro.dicom`, and `fslr` packages are all on CRAN and can be installed using the standard `install.packages` way:
```{r, eval = FALSE}
if (!require(oro.nifti)) {
install.packages("oro.nifti")
}
if (!require(oro.dicom)) {
install.packages("oro.dicom")
}
if (!require(fslr)) {
install.packages("fslr")
}
```
## Installing GitHub Packages
Some of the packages used are not on CRAN, and must be installed using `devtools`.
Note below, `fslr` is included. If you would like to use the GitHub version (in development, aka may break), then please use the code below. Otherwise use the CRAN version.
### Installing `devtools`
```{r github, eval = FALSE}
if (!require(devtools)) {
install.packages("devtools")
}
```
### Installing Development version of `fslr`
```{r github2, eval = FALSE}
if (!require(fslr)) {
devtools::install_github("muschellij2/fslr")
}
```
### Installing `ITKR`
Installing `ITKR` requires the `cmaker` package (at the time of writing):
```{r ITKR, eval = FALSE}
if (!require(cmaker)) {
devtools::install_github("stnava/cmaker")
}
if (!require(ITKR)) {
devtools::install_github("stnava/ITKR")
}
```
If the above doesn't work, and you have **double checked** CMake and git are installed, try the following command:
```{r ITKR_musch, eval = FALSE}
if (!require(ITKR)) {
devtools::install_github("muschellij2/ITKR")
}
```
This is a forked version of `ITKR` and may not be the most up to date, but has some changes to the install script
### Installing `ANTsR` and `extrantsr`
Note, if `ITKR` installation failed, then `ANTsR` installation will fail as it depends on `ITKR` and the `extrantsr` installation will fail because it depends on `ANTsR`.
```{r ANTsR, eval = FALSE}
if (!require(ANTsR)) {
devtools::install_github("stnava/ANTsR")
}
if (!require(extrantsr)) {
devtools::install_github("muschellij2/extrantsr")
}
```
### Installing `ANTsR` from a Binary
If `ANTsR` installation does not work above, but `ITKR` installed, you can try the release version of `ANTsR` for your respective system by downloading the tarballs from:
[https://github.com/stnava/ANTsR/releases](https://github.com/stnava/ANTsR/releases), and installing from `install.packages`:
```{r, eval = FALSE}
path_to_tarball = "~/Downloads/ANTsR_OSX_0.3.tgz" # example - must change
install.packages(path_to_tarball, repos = NULL, type = .Platform$pkgType)
```
## Updating Packages
The `ITKR` and `ANTsR` packages take a long time to install. If you would like to update `extrantsr` and use `devtools::install_github("muschellij2/extrantsr")`, it will by default check to see if the `ITKR` and `ANTsR` packages had changed since last installation and try to upgrade them.
If you want to keep the versions of `ITKR` and `ANTsR` and just update `extrantsr`, you can use the following code:
```{r, eval = FALSE}
devtools::install_github("muschellij2/extrantsr", upgrade_dependencies = FALSE)
```