Difference between revisions of "NiftyReg install"

From CMIC
Jump to: navigation, search
 
(11 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
==Windows==
 
==Windows==
 
The building process is the following:
 
The building process is the following:
# Get the source
+
* Get the source
# You'll then need to create a new directory for the build: "niftyreg-build"
+
* 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
+
* 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 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:
+
* 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 OpenMP
 
:::Use SSE
 
:::Use SSE
Line 26: Line 26:
  
 
==Linux==
 
==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
 +
::<code>ccmake <niftyreg_source></code>
 +
:: Set the <code>CMAKE_BUILD_TYPE</code> variable to <code>Release</code>, <code>RelWithDebInfo</code> or <code>Debug</code>
 +
:: If you want to use the SSE implementation for the spline computation and your compiler allows for it, set <code>USE_SSE</code> to ON.
 +
:: If you want to compile the registration algorithms with double precision instead of single precision, set <code>USE_DOUBLE</code> 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 <code> CMAKE_INSTALL_PREFIX</code> to <code><niftyreg_install></code>
 +
:: Once all the options have been configured, press <code>c</code> to configure and then <code>g</code> to generate.
 +
* After running ccmake, run:
 +
:::<code>make</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>PATH=${PATH}:${NIFTYREG_INSTALL}/bin</code>
 +
:::<code>LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NIFTYREG_INSTALL}/lib</code>
 +
:::<code>export PATH</code>
 +
:::<code>export LD_LIBRARY_PATH</code>
 +
* After opening a new terminal, you should be able to run:
 +
:::<code>reg_f3d -h</code>
  
 
==MacOs==
 
==MacOs==
 
+
The build process is the following:
TEMP
+
* Get the source in folder <niftyreg_source>
::<code>ccmake -D CMAKE_C_COMPILER=/opt/local/bin/gcc-mp-4.4 -D CMAKE_CXX_COMPILER=/opt/local/bin/g++-mp-4.4 -D BUILD_ALL_DEP=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/Users/mmodat/Code/Install/niftyreg_install -D USE_CUDA=ON -D CUDA_HOST_COMPILER=/usr/bin/clang -D CMAKE_CXX_FLAGS="-lcudart -lcuda -L/usr/local/cuda/lib -stdlib=libstdc++ -m64 -arch x86_64" -D CMAKE_C_FLAGS="-lcudart -lcuda -L/usr/local/cuda/lib -stdlib=libstdc++ -m64 -arch x86_64" ~/Dropbox/niftyreg</code>
+
* Create the folders <niftyreg_build> and <niftyreg_install>
 +
* Through the terminal, change directory to the <niftyreg_build> folder and run the following command
 +
::<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:
 +
:::<code>ccmake -D CMAKE_C_COMPILER=<c_compiler> -D CMAKE_CXX_COMPILER=<c++_compiler> <niftyreg_source></code>
 +
:: In order to use CUDA, you will need to set the <code>USE_CUDA</code> flag to <code>ON</code>, set the <code>CUDA_HOST_COMPILER</code> to <code>/usr/bin/clang</code> and set the <code>CMAKE_EXE_LINKER_FLAGS</code> to <code>"-lcudart -lcuda -L/usr/local/cuda/lib"</code> assuming CUDA has been installed in <code>/usr/local/</code> (and <code>CMAKE_CXX_FLAGS</code> to <code>-stdlib=libstdc++</code> with <code>clang</code> and <code>clang++</code> as compilers).
 +
:: Set the <code>CMAKE_BUILD_TYPE</code> variable to <code>Release</code>, <code>RelWithDebInfo</code> or <code>Debug</code>
 +
:: If you want to use the SSE implementation for the spline computation and your compiler allows for it, set <code>USE_SSE</code> to ON.
 +
:: If you want to compile the registration algorithms with double precision instead of single precision, set <code>USE_DOUBLE</code> 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 <code> CMAKE_INSTALL_PREFIX</code> to <code><niftyreg_install></code>
 +
:: Once all the options have been configured, press <code>c</code> to configure and then <code>g</code> to generate.
 +
:: 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_EXE_LINKER_FLAGS="-lcudart -lcuda -L/usr/local/cuda/lib" <niftyreg_source></code>
 +
* After running cmake or ccmake, run:
 +
:::<code>make</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>PATH=${PATH}:${NIFTYREG_INSTALL}/bin</code>
 +
:::<code>LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NIFTYREG_INSTALL}/lib</code>
 +
:::<code>export PATH</code>
 +
:::<code>export 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>

Latest revision as of 10:43, 13 March 2017

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 to Release, RelWithDebInfo or Debug
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 then g 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 to ON, set the CUDA_HOST_COMPILER to /usr/bin/clang and set the CMAKE_EXE_LINKER_FLAGS to "-lcudart -lcuda -L/usr/local/cuda/lib" assuming CUDA has been installed in /usr/local/ (and CMAKE_CXX_FLAGS to -stdlib=libstdc++ with clang and clang++ as compilers).
Set the CMAKE_BUILD_TYPE variable to Release, RelWithDebInfo or Debug
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 then g 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