FARSIGHT Tutorials/Building Software/Building ITK
Contents |
Overview
This tutorial describes how to build ITK with the options required for using it along with FARSIGHT. In particular it includes instructions on how to build the Python wrapping using WrapITK.
Download ITK
The source code of ITK can be downloaded from
New releases of ITK are posted every three months.
Please use the most recent release of the software.
Configure
Get CMake
You will need the most recent release of CMake in order to configure ITK.
Although CMake is an Open Source project, you don't need to download the source code and build it. Instead you can simply download one of the binary builds that are available at
Choose the one appropriate for your platform.
Please note that if you are using a GNU/Linux distribution or GNU/Cygwin, you may have CMake already installed. CMake is available as a package in the most popular GNU/Linux distributions (Debian, Ubuntu, Redhat...).
Define SOURCE and BINARY directories
- CMake uses the concept of SOURCE and BINARY directories
- The SOURCE directory, in this case, is the directory where you put the source code of ITK
- The BINARY directory, in this case, is the directory where you want to compile and build ITK
This is known as "out of source" building and it is strongly recommended as a good practice, as opposed to the "in-source" building where you could mix the binary and source directories into a single one, and generate great confusion and future suffering.
GNU/Linux & Mac
For the sake this tutorial, lets assume that you are using
- SOURCE directory = $HOME/src/Insight
- BINARY directory = $HOME/bin/InsightWithPython
That means that you expanded the source code of ITK in the directory "$HOME/src/Insight" and that you manually created the directory "$HOME/bin/InsightWithPython" with a command such as
cd mkdir InsightWithPython
Then you should move into the BINARY directory run "ccmake" in order to configure ITK. When you run "ccmake" you provide the SOURCE directory as an argument.
cd InsightWithPython ccmake $HOME/src/Insight
This will show an image such as:
hit the "c" key in order to "configure". At this point CMake will test the capabilities of your compiler, after a couple of minutes it will show you an image similar to:
Do the following:
- Turn OFF the option BUILD_EXAMPLES
- Turn OFF the option BUILD_TESTING
- Turn ON the option BUILD_SHARED
- Write "Release" in the option CMAKE_BUILD_TYPE
- Hit the "c" key again in order to configure with these changes
CMake will then show you a screen similar to:
- Now pass to the advance variables by hitting the "t" key (for "toggle to advanced") and
- Hit the "/" key (for "search") and type "WRAP_ITK" in order to jump to the option that can turn wrapping ON
- Turn ON the option USE_WRAP_ITK