|
Installation of ITK in Ubuntu
|
ITK requires ccmake and g++ for program compilation.Refer to install-ubuntu for information about installing these packages.
Installation of ITK is performed by compiling the source codes. Note that ITK's installation package will prevent you from building ITK in the same directory as the source.
Suppose you have downloaded and unzip the source into ~/Downloads/InsightToolkit. Now, create another directory ~/Downloads/itk. Then, issue the following commands:
cd ~/Downloads/itk
ccmake ../InsightToolkit
Press c to configure, use arrow key to go to the option items, then press enter to change the option. Then, press g to generate the Makefile. Then, compile the source codes using make:
make -j4
The -j4 option allows make to run up to 4 jobs at the same time. This will save time on a computer with multiple processors as compilation takes a long time. Specifying -j without the argument may cause the system to freeze.
Finally, issue
sudo make install
to copy the header and library files to standard directories, usually in /usr/local. Let's say they are kept under InsightToolkit-3.20.0 in /usr/local/include and /usr/local/lib. Then, it is good to create symbolic links to these directories for convenience of use:
cd /usr/local/include
sudo ln -s InsightToolkit-3.20.0 itk
cd /usr/local/lib
sudo ln -s InsightToolkit-3.20.0 itk
|
Using ITK with VTK |
To use ITK with VTK, e.g., converting ITK image to VTK image, you need to install Insight Applications.
Download Insight Applications and unzip it. Go to the directory that contains Insight Applications, say, InsightApplications.
Then, run
ccmake .
Press c to configure, use arrow key to go to the option items, then press enter to change option. Then, press g to generate the make file. Then, compile the source codes using make:
sudo make -j4
sudo make install
|
Troubleshooting |
> In case the compilation terminates unsuccessfully with errors in test programs, use ccmake to turn off compilation of test programs,
and repeat the process.
> Cmake keeps information about ITK's include directory in a standard file, e.g., /usr/share/cmake-2.8/Modules/FindITK.cmake.
If you have previously installed another version of ITK, this file may be set to point to the previous directory instead of the new directory.
This inconsistency may create problem when compiling ITK or Insight Application.
|
Compiling ITK Programs |
To compile a ITK program, go to the directory that contains the program, create the file CMakeLists.txt. This file contains information that tells cmake how to generate the required make file. For example,
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT (test1)
In this example, the name of the source file is test1.cpp and the names of the project and the executable are test1.
After creating CMakeLists.txt, compile the program as follows:
cmake .
make
For more information of using cmake, refer to Kitware's online page.
|
|