This document provides additional details about installation that may help you solve certain difficulties, especially on Windows or Mac platforms.
The source code for this vignette is available at https://github.com/natverse/nat/blob/master/vignettes/Installation.Rmd. If you find something unclear or notice a typo, I would be very happy if you would click on the Pencil Icon on that page or follow this link to edit and suggest an alternative wording. Don’t be shy about doing this; I have to review any change and even if your suggestion is not perfect it will still be a prompt for me to improve this document. Thank you!
nat is an R package and therefore runs on Mac/Linux/Windows. The only pre-requisite for most functionality is a recent version of R (>=3.1.0 recommended).
3D visualisation is provided by the rgl package based on OpenGL. On Mac OS X if you use RStudio or R from the terminal, you must have a copy of XQuartz, the X11 window manager, installed. This is no longer a default install since Mac OS X 10.8. You need to install XQuartz, before installing the nat package. Logout and login for the installation to take effect. You can get it from https://www.xquartz.org/. This page is also linked from the Download R for (Mac) OS X page.
If you want to apply non-rigid registrations calculated by the Computational Morphometry Toolkit (CMTK) you will need to install that separately – see section External Dependencies below.
As of v1.0 there is a released version on CRAN. This is normally updated only every few months.
install.packages("nat")
If you wish to run the package tests, it is necessary to install with all dependencies:
install.packages("nat", dependencies=TRUE)
nat remains under quite active development, so we generally suggest using the development version directly from github. The recommended way to do this is to install Hadley Wickham’s invaluable devtools package (if you have not already done so) and then use that to install nat.
# install devtools if required
if (!require("devtools")) install.packages("devtools")
# then install nat
::install_github("natverse/nat") devtools
The nat package includes extensive unit tests which are run along with R’s (extremely fastidious) package check routines by the Travis continuous integration server. The master branch is therefore considered very stable and may well contain fixes or enhancements over released versions. However, you can install any release version including the latest release as follows:
::install_github("natverse/nat@v1.8.6") devtools
The same syntax can be used to install any arbitrary version that you
want from github. See ?install_github
for details.
Note: Windows users need Rtools to install in this way, but devtools should offer to install this for you if you do not already have it.
nat is self sufficient for core functionality, but the transformation of 3D data using Computational Morphometry Toolkit (CMTK) registrations depends on an external installation of that toolkit. CMTK binaries can be downloaded for Windows, Linux and Mac at https://www.nitrc.org/projects/cmtk/. Source code is available from the same site or an unofficial mirror repository at https://github.com/jefferis/cmtk. We have extensive experience of using CMTK under Linux (where we compile from source) and Mac (where we compile or use the MacOSX-10.6-x86_64.dmg binary installers). We have also used neurodebian to install as part of our (now retired) Travis continuous integration setup (see the project’s .travis.yml file).
We have much less experience using CMTK on Windows than on Mac/Linux platforms. Experiments in May 2016 suggest that the best option is to use the cygwin CMTK distribution (cygwin provides a linux like environment). Here are the steps we took:
C:\cygwin64
CMTK-3.3.1-CYGWIN-x86_64.tar.gz
to the cygwin
folder (C:\cygwin64
)tar -xvf CMTK-3.3.1-CYGWIN-x86_64.tar.gz
to extract CMTK to
the cygwin folder.C:\cygwin64\bin
to your windows path
(since v1.8.10 nat should look after this - see ?cmtk.bindir).cmtk.bindir()
should now correctly
identify the CMTK binary directory. You can test that the executables
are working by trying the following in R
library(nat);cmtk.dof2mat(version = TRUE)
which should then
respond with “3.3.1” if you have installed the CMTK version we have just
mentioned.