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.
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
This can take a few minutes because we need to compile it from scratch. Here is a step-by-step guide for macOS:
- Install command line developer tools:
xcode-select --install
- For this to work we also need
cmake
installed and in your system path. We can download from here. After we succesfully installedcmake
we need to make it available from the command line:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
- Now we follow the steps from the
SimpleITK
building documentation:
git clone https://itk.org/SimpleITK.git
mkdir SimpleITK-build
cd SimpleITK-build
- 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
- Compile (the number indicates how many cores we want to use):
make -j4
- Now it's compiled and we can install it in
R
:
cd SimpleITK-build/Wrapping/R/Packaging
R CMD INSTALL SimpleITK
- Finally, we are ready to install the package
braincog
:
install.packages("devtools")
devtools::install_github("ChristofSeiler/braincog")
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)