NiftyReg install
From CMIC
Contents
Requirements
- CMake is a open-source cross-platform build system. You can download it from here.
- A Compiler. Using MacOS, you can install XCode, downloadable from here. For windows, Visual Studio 2008 or 2010 Professional Edition (if you want to enable OpenMP on Windows then you must have VS-PRO installed)
- Currently NiftyReg can use GPU accelerated computing through CUDA from NVIDIA which can be downloaded from here
Source
- You can download the latest release from the project SourceForge page here.
- Alternatively, you can download the latest version from the git repository on SourceForge, using:
git clone git://git.code.sf.net/p/niftyreg/git niftyreg-git
Windows
The building process is the following:
- Get the source
- You'll then need to create a new directory for the build: "niftyreg-build"
- You launch CMake-Gui, you set the source path to "niftyreg" and the build path to "niftyreg-build" then hit configure
- Cmake will prompt you to select the generator, which means you'll need to select the Visual Studio version you have installed earlier
- CMake will run for about a minute, then it will present you with some configuration options. Make sure the following ones are enabled:
- Use OpenMP
- Use SSE
- Set the CMAKE_INSTALL_PREFIX to the folder where you want to install NiftyReg.
- Note, that if you want to install NiftyReg under Program Files, you'll need to create the folder yourself and explicitly apply full permissions to write for your user. Once the flags are set then hit configure and generate. Cmake will generate you the Visual Studio project files.
- Go to "niftyreg-build", and launch NiftyReg.sln. Consequently Visual Studio will start up.
- In Visual Studio select build type, for generic use select Release and build the project (hit F7). VS will run for a couple minutes.
- Once the build 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.
- Probably you'll want to add the install folder to your system path.
Linux
The build process is the following:
- Get the source in folder <niftyreg_source>
- Create the folders <niftyreg_build> and <niftyreg_install>
- Through the terminal, change directory to the <niftyreg_build> folder and run the following command
ccmake <niftyreg_source>
- Set the
CMAKE_BUILD_TYPE
variable toRelease
,RelWithDebInfo
orDebug
- If you want to use the SSE implementation for the spline computation and your compiler allows for it, set
USE_SSE
to ON. - If you want to compile the registration algorithms with double precision instead of single precision, set
USE_DOUBLE
to ON. Note that double precision can not be used concurrently with SEE or CUDA. - If you want to install NiftyReg after building it, set
CMAKE_INSTALL_PREFIX
to<niftyreg_install>
- Once all the options have been configured, press
c
to configure and theng
to generate.
- After running ccmake, run:
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
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NIFTYREG_INSTALL}/lib
export PATH
export LD_LIBRARY_PATH
- After opening a new terminal, you should be able to run:
reg_f3d -h
MacOs
The build process is the following:
- Get the source in folder <niftyreg_source>
- Create the folders <niftyreg_build> and <niftyreg_install>
- Through the terminal, change directory to the <niftyreg_build> folder and run the following command
ccmake <niftyreg_source>
- The default C and C++ compiler will be used by default. If you want to use OpenMP, you won't be able to install the Xcode native compilers and will need to install OpenMP enabling compilers (through MacPort for example) and run:
ccmake -D CMAKE_C_COMPILER=<c_compiler> -D CMAKE_CXX_COMPILER=<c++_compiler> <niftyreg_source>
- In order to use CUDA, you will need to set the
USE_CUDA
flag toON
, set theCUDA_HOST_COMPILER
to/usr/bin/clang
and set theCMAKE_EXE_LINKER_FLAGS
to"-lcudart -lcuda -L/usr/local/cuda/lib"
assuming CUDA has been installed in/usr/local/
(andCMAKE_CXX_FLAGS
to-stdlib=libstdc++
withclang
andclang++
as compilers). - Set the
CMAKE_BUILD_TYPE
variable toRelease
,RelWithDebInfo
orDebug
- If you want to use the SSE implementation for the spline computation and your compiler allows for it, set
USE_SSE
to ON. - If you want to compile the registration algorithms with double precision instead of single precision, set
USE_DOUBLE
to ON. Note that double precision can not be used concurrently with SEE or CUDA. - If you want to install NiftyReg after building it, set
CMAKE_INSTALL_PREFIX
to<niftyreg_install>
- Once all the options have been configured, press
c
to configure and theng
to generate. - Alternatively, if you want to use OpenMP and CUDA, you could directly run the following command:
cmake -D CMAKE_C_COMPILER=<c_compiler> -D CMAKE_CXX_COMPILER=<c++_compiler> -D BUILD_ALL_DEP=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=<niftyreg_install> -D USE_CUDA=ON -D CUDA_HOST_COMPILER=/usr/bin/clang -D CMAKE_EXE_LINKER_FLAGS="-lcudart -lcuda -L/usr/local/cuda/lib" <niftyreg_source>
- After running cmake or ccmake, run:
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
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NIFTYREG_INSTALL}/lib
export PATH
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=LD_LIBRARY_PATH
- After opening a new terminal, you should be able to run:
reg_f3d -h