Installing wholebrain on Ubuntu/Debian

  1. Install R, FFTW and OpenCV 3
  2. Install STAN from within R
  3. Install wholebrain from within R

Install R, FFTW and OpenCV 3

Install from terminal using apt:


sudo apt-get install build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev
sudo apt-get -y install r-base
sudo apt-get install fftw3 fftw3-dev pkg-config

WholeBrain requires OpenCV 3.0.0 or higher, currently sudo apt-get for opencv will install 2.4 which is missing several key functions.

This is how you compile OpenCV 3.0.0 or higher form source on debian/ubuntu:

Install required and recommended packages:


sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

Download OpenCV 3.0.0 source:


sudo apt-get install -y unzip wget
cd ~
wget https://github.com/Itseez/opencv/archive/3.0.0.zip
unzip 3.0.0.zip
rm 3.0.0.zip
cd opencv-3.0.0

Make a build/release directory:


mkdir release
cd release

Use cmake to make a make-file and then compile:


cmake -DWITH_TBB=ON -DWITH_XINE=ON -DWITH_IPP=ON ..
make -j4
sudo make install

Fix -lippicv linking error that will otherwise happen during R installation:


sudo cp ~/opencv-3.0.0/3rdparty/ippicv/unpack/ippicv_lnx/lib/intel64/libippicv.a /usr/local/lib
sudo ldconfig

Install STAN from within R

Open up a new session of R.

R 

Set the number of processes to use for the build to the number of cores on your machine you want to devote to the build. For example, if you are running a quad core machine and want to use 4 processes, execute the following in R.

Sys.setenv(MAKEFLAGS = "-j4")

Install the latest version of rstan from CRAN:

install.packages("rstan", dependencies = TRUE)

If the installation worked restart R.
Then tryout that STAN works by running the following code form within R.


library(rstan)
model<-'data{
int N;
real y[N];
}
parameters{
real mu;
real sigma;
}
model{
y ~ normal(mu, sigma);
}'

model_data

If it produces a histogram of the posterior samples of the mean parameter mu everything works.

Install wholebrain from within R

Run R:

R 

Compile and install wholebrain using the devtools R package:

if (!require(devtools)) { 
    install.packages("devtools") 
}

devtools::install_github("tractatus/wholebrain") 

Try running wholebrain:

library(wholebrain) 
filename<-system.file('sample_tiles/rabiesEGFP.tif', package='wholebrain') 
seg<-segment(filename)