Saturday, 2 March 2013

ITK installation for MSVC


ITK: Insight Tool Kit

The Insight Toolkit (ITK) is an open-source software toolkit for performing registration and segmentation.

ITK is implemented in C++. It is cross-platform, using a build environment known as CMake to manage the compilation process in a platform-independent way. In addition, an automated wrapping process (Cable) generates interfaces between C++ and interpreted programming languages such as Tcl, Java, and Python. This enables developers to create software using a variety of programming languages. ITK’s C++ implementation style is referred to as generic programming, which is to say that it uses templates so that the same code can be applied generically to any class or type that happens to support the operations used. Such C++ templating means that the code is highly efficient, and that many software problems are discovered at compile-time, rather than at run-time during program execution.

Installing ITK

ITK can be downloaded without cost from the following web site:

ITK has been developed and tested across different combinations of operating systems, compilers, and hardware platforms including MS-Windows, Linux on Intel-compatible hardware, Solaris, IRIX, Mac OSX, and Cygwin. It is known to work with the following compilers:
• Visual Studio 6, .NET 2002, .NET 2003
• GCC 2.95.x, 2.96, 3.x
• SGI MIPSpro 7.3x
• Borland 5.5

The challenge of supporting ITK across platforms has been solved through the use of CMake,
a cross-platform, open-source build system.

ITK requires at least CMake version 2.0. CMake can be downloaded at no cost from

Install cmake.
Now open CMake and for ITK configuration and build follow steps:



1.       Make an ITK folder where ITK will be installed and build
2.       Make two subdirectories inside ITK folder named src and bin
3.       Extract all files of downloaded ITK zip file into src
4.       Open Cmake gui
5.       Enter path of src into  Where is the source code
6.       Enter path of bin into Where to build binaries
7.       Now click on Configure
8.    Select compiler for example if you are building for 64 bit choose 64 bit compiler.
9.    Select configuration options according to your need and configure again till red selection disappeared.
10.  Then click on Generate
11.     Now close Cmake and go in bin of ITK find ITK.sln file and click on it, it will open Visual Studio
12.     In solution explorer  select ALL_BUILD and build it [build will take around 90 minutes]

Now ITK library build.

Testing Built by HelloWorld Example

Go to \ITK\SRC\Examples\Installation folder and copy both files CMakeLists.txt and HelloWorld.cpp
Make a test folder with src and bin subfolders
Paste both files into src
Open Cmake and give path of src in source code and of bin in binary and configure then generate
Open bin of test folder and click on HelloWorld.sln it will open Visual Studio
Now build if error then ITK install is not ok.
After build open bin folder of test and check debug folder if there is an exe of HelloWorld exist if it is then ITK installed and build is ok.

3 comments:

  1. Thank you for the clear instructions.. I followed them till step #10 (building ALL_BUILD) but I can't see any building progress.. VS only indicate that build started then nothing.. I let it work for about 2 hours but didn't give me any sign of progressing or completion. After 3 hours I had to cancel the build. I'm not sure what is causing this problem and I was hoping that you can help me with it..
    Thanks

    ReplyDelete
  2. Thanks for these useful document.
    I just encountered the same problem as Samar M, is there a solution to this one?

    Many thanks

    ReplyDelete
  3. Great work. I successfully run the testing.Thank you~

    ReplyDelete