README.md

R Package braincog

Before we can install braincog we have to install SimpleITK, an R wrapper for ITK. ITK provides the latest and robust medical image processing tools for d-dimensional images.

Easy Installation on macOS Sierra

Pre-compiled on macOS Sierra 10.12.6. To install SimpleITK package:

git clone https://github.com/ChristofSeiler/SimpleITK_Binaries.git
cd SimpleITK_Binaries
unzip SimpleITK.zip
R CMD INSTALL SimpleITK

Installation on Other Systems

This can take a few minutes because we need to compile it from scratch. Here is a step-by-step guide for macOS:

  1. Install command line developer tools:
xcode-select --install
  1. For this to work we also need cmake installed and in your system path. We can download from here. After we succesfully installed cmake we need to make it available from the command line:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
  1. Now we follow the steps from the SimpleITK building documentation:
git clone https://itk.org/SimpleITK.git
mkdir SimpleITK-build
cd SimpleITK-build
  1. Configure build and disable some feature that we don't need to speed-up compilaton time:
cmake \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTING=OFF \
-D WRAP_PYTHON=OFF \
-D WRAP_RUBY=OFF \
-D WRAP_TCL=OFF \
-D WRAP_R=ON \
../SimpleITK/SuperBuild
  1. Compile (the number indicates how many cores we want to use):
make -j4
  1. Now it's compiled and we can install it in R:
cd SimpleITK-build/Wrapping/R/Packaging
R CMD INSTALL SimpleITK
  1. Finally, we are ready to install the package braincog:
install.packages("devtools")
devtools::install_github("ChristofSeiler/braincog")

Getting Started

The input is morphometry data from registration algorithms such as ANTs. We encode group labels using a factor fac variable with two levels.

# fac: (n x 1) factor with two levels
# morphometry: (n x num_voxels) matrix
# cognition: (n x num_tests) matrix
# gray_matter: binary image
res = braincog(fac = group,
               morphometry = morphometry, 
               cognition = cognition,
               gray_matter = gray_matter)
summary(res)
plot(res)


ChristofSeiler/braincog documentation built on May 7, 2019, 1:22 p.m.