Skip to content

install

Marc Modat edited this page May 11, 2017 · 12 revisions

Table of Content

Requirements


  • CMake is an open-source cross-platform build system. You can download it from here.

  • Compiler.
  • Using MacOS, you can install XCode, downloadable from this page. Note that in order to take advantage of OpenMP, gcc will also have to be installed. One popular way to install it is to use homebrew.
  • For windows, Visual Studio 2008, 2010 or 2013 has to be installed. OpenMP here requires the professional version.

  • NiftyReg can use GPU accelerated computing through CUDA or OpenCL from NVIDIA, which can be downloaded from here

Install from source

Download the source

The source files can be downloaded from the SourceForge project page.

Alternatively the source files can be downloaded using git from this repository using:

git clone git://git.code.sf.net/p/niftyreg/git niftyreg

or that one with the following command:

git clone [email protected]:mmodat/niftyreg.git niftyreg

Note that the cmiclab repository is the main repository while the sourceforge only contains the master branch.

Compile and install the source on Windows

  • Create a folder to build the code and another one to install the code, e.g. niftyreg_build and niftyreg_install respectively.

  • Launch CMake-Gui. Set the source path to niftyreg (where you copied/cloned the source files) and the build path to niftyreg-build then hit configure. CMake-Gui will prompt you to select the generator, which means you'll need to select a version of Visual Studio that have been installed on your computer. CMake-Gui will present you with some configuration options. Once you have selected your desired options and set the CMAKE_INSTALL_PREFIX option to the folder where you want to install NiftyReg (e.g. niftyreg_install), press configure and then generate. CMake-gui will generate the Visual Studio project files. Below is an example of selected options:

CMake-gui

  • Go to the niftyreg_build folder. You can see below the files that are generated by CMake-gui in the niftyreg_build folder:

niftyreg_build

Double click on the file NiftyReg.sln and Visual Studio will start up. In Visual Studio select build type, for generic use select Release and build the project (hit F7). Once the build is finished select and run the install task (Right Click on Install > Project Only > Build only Install). This will install NiftyReg to the folder you selected earlier.

  • You could then install the niftyreg_install folder to your system path.

Compile and install the source on Linux or MacOs

  • Create the folders niftyreg_build and niftyreg_install:

mkdir niftyreg_{build,install}

  • In the terminal, change directory to the niftyreg_build folder and run the following command:

ccmake <niftyreg_source_file_path>

  • Press the c key to configure the project. Set CMAKE_INSTALL_PREFIX to niftyreg_install. Below is an example after the option configuration on MacOs:

ccmake-mac

  • Once all the options have been configured, press c to configure and then g to generate.

  • In the terminal run the following commands:

make

make install

  • The code will be installed in niftyreg_install and you can update your ~/.profile or ~/.basrc file with the following lines:
export NIFTYREG_INSTALL=niftyreg_install
PATH=${PATH}:${NIFTYREG_INSTALL}/bin
export PATH
  • After opening a new terminal, you should be able to run:

reg_f3d -h

CMake configuration Niftyreg specific options

Option Description
BUILD_ALL_DEP If set to ON, the z library will be build even if it is available on the computer.
BUILD_DEV If set to ON, some part of the code under development will be build.
BUILD_SHARED_LIBS If set to ON, the NiftyReg libraries will be build as shared. They are built as static by default.
BUILD_TESTING If set to ON, the data for testing as well as the unit tests will be build. It requires matlab to generate the test data.
USE_CUDA If set to ON, the code is compiled using CUDA.
USE_OPENCL If set to ON, the code is compiled using OpenCL
USE_OPENMP If set to ON, the code is compiled using OpenMP. Not that this can not be done with a clang compiler.
USE_SSD If set to ON, the code is compiled using SSE. SSE code is mostly present in the cubic spline deformation field computation.
Clone this wiki locally