Difference between revisions of "NiftyReg install"
From CMIC
(→MacOs) |
(→MacOs) |
||
Line 31: | Line 31: | ||
The build process is the following: | The build process is the following: | ||
− | + | * Get the source in folder <niftyreg_source> | |
− | + | * Create the folder <niftyreg_build> and <niftyreg_install> | |
− | + | * In the <niftyreg_build> folder, run the following command | |
::<code>ccmake <niftyreg_source></code> | ::<code>ccmake <niftyreg_source></code> | ||
:: 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: | :: 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: | ||
Line 45: | Line 45: | ||
:: Alternatively, if you want to use OpenMP and CUDA, you could directly run the following command: | :: Alternatively, if you want to use OpenMP and CUDA, you could directly run the following command: | ||
:::<code>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_C_FLAGS="-lcudart -lcuda -L/usr/local/cuda/lib" <niftyreg_source></code> | :::<code>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_C_FLAGS="-lcudart -lcuda -L/usr/local/cuda/lib" <niftyreg_source></code> | ||
− | + | * After running cmake or ccmake, run: | |
:::<code>make</code> | :::<code>make</code> | ||
:::<code>make install</code> | :::<code>make install</code> | ||
− | + | * The code will be installed in <niftyreg_install> and you can update your <code>~/.profile</code> or <code>~/.basrc</code> file with the following lines | |
:::<code>export NIFTYREG_INSTALL=<niftyreg_install></code> | :::<code>export NIFTYREG_INSTALL=<niftyreg_install></code> | ||
:::<code>PATH=${PATH}:${NIFTYREG_INSTALL}/bin</code> | :::<code>PATH=${PATH}:${NIFTYREG_INSTALL}/bin</code> | ||
Line 55: | Line 55: | ||
:::<code>export LD_LIBRARY_PATH</code> | :::<code>export LD_LIBRARY_PATH</code> | ||
:::<code>export DYLD_LIBRARY_PATH=LD_LIBRARY_PATH</code> | :::<code>export DYLD_LIBRARY_PATH=LD_LIBRARY_PATH</code> | ||
− | + | * After opening a new terminal, you should be able to run: | |
:::<code>reg_f3d -h</code> | :::<code>reg_f3d -h</code> |
Revision as of 14:02, 31 October 2014
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
MacOs
The build process is the following:
- Get the source in folder <niftyreg_source>
- Create the folder <niftyreg_build> and <niftyreg_install>
- In the <niftyreg_build> folder, 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_C_FLAGS
to"-lcudart -lcuda -L/usr/local/cuda/lib"
assuming CUDA has been installed in/usr/local/
. - 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_C_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