ITK/Insight Applications: Difference between revisions
No edit summary |
Psychoslave (talk | contribs) (internal link to installation instructions) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
The Insight Toolkit itself is an "engine", and has no dependencies or requirements on any particular GUI or visualisation libraries. (In fact ITK can easily be used to write both console and batch-mode applications.) | The Insight Toolkit itself is an "engine", and has no dependencies or requirements on any particular GUI or visualisation libraries. (In fact ITK can easily be used to write both console and batch-mode applications.) | ||
[http://www.itk.org/cgi-bin/viewcvs.cgi?root=InsightApplications InsightApplications (CVS)] is a separate CVS repository that contains a wide variety of sample code, that demonstrate how to build complete applications with ITK. | [http://www.itk.org/cgi-bin/viewcvs.cgi?root=InsightApplications InsightApplications (CVS)] ([[Complete_Setup#ITK|installation instructions]]) is a separate CVS repository that contains a wide variety of sample code, that demonstrate how to build complete applications with ITK. | ||
== Highlights == | == Highlights == | ||
Line 29: | Line 29: | ||
As of version 1.1.6 FLTK can now be configured using CMake. | As of version 1.1.6 FLTK can now be configured using CMake. | ||
Otherwise, if not configured with CMake, make sure that you have an installed version of FLTK | Otherwise, if not configured with CMake, make sure that you have an installed version of FLTK. The installation process actually create symbolic links to the correct headers. | ||
=== Matching Version === | === Matching Version === | ||
Line 89: | Line 89: | ||
* add the directory to your `PATH` (under Windows) or `LD_LIBRARY_PATH` (under *nix systems), or | * add the directory to your `PATH` (under Windows) or `LD_LIBRARY_PATH` (under *nix systems), or | ||
* under *nix, rely on the rpath option being set to hard-code in the executables the location of the extra libraries | * under *nix, rely on the rpath option being set to hard-code in the executables the location of the extra libraries | ||
===Compiling FLTK-dependent components on Mac === | |||
MacPorts http://macports.org can be used to install the compatible version of FLTK on Mac (tested on Snow Leopard). This installs a 32-bit version of FLTK, since there seem to be known issues related to 64-bit install. | |||
Because of this, ITK used in ITKApps also needs to be compiled in 32-bit mode. To do this, set the following flags before running cmake and configuring ITK, compile ITK, then use the same flags in ITKApps: | |||
CXXFLAGS=-m32 | |||
CFLAGS=-m32 | |||
To compile ImageViewer, you need to enable FLTK and Auxiliary flags in CMake. | |||
Finally, the png and jpeg libs installed by mac ports are not correctly resolved during linking ImageViewer. I pointed compiler explicitly to /opt/local/lib/lib{png|jpeg}.a to resolve this issue. | |||
{{ITK/Template/Footer}} | {{ITK/Template/Footer}} |
Latest revision as of 09:50, 2 March 2012
The Insight Toolkit itself is an "engine", and has no dependencies or requirements on any particular GUI or visualisation libraries. (In fact ITK can easily be used to write both console and batch-mode applications.)
InsightApplications (CVS) (installation instructions) is a separate CVS repository that contains a wide variety of sample code, that demonstrate how to build complete applications with ITK.
Highlights
Here is a small selection of the applications included:
- SNAP : A complete segmentation tool
- ... many more ...
Building Insight Applications
This section describes how to build the Insight Applications.
Prerequisites
The following information is aimed at version 1.6 of the toolkit:
- ITK version 1.6+
- FLTK version 1.1.3 (FLTK 2.x is not supported)
- Qt version 2.0+
- VTK version 4.2
- OpenGL/GLUT version 1.2+
The most commonly used GUI is FLTK, and many applications use VTK also. If you have these two libraries, you can build most of the applications.
FLTK installation
As of version 1.1.6 FLTK can now be configured using CMake. Otherwise, if not configured with CMake, make sure that you have an installed version of FLTK. The installation process actually create symbolic links to the correct headers.
Matching Version
Note that it is very important to match the version of InsightApplications with the version of ITK you are using. Thus, if you have version 1.6.0 of the toolkit installed, you should download the corresponding version 1.6.0 of InsightApplications here. If you have installed ITK from a CVS build, you should obtain a checkout of the applications from the same day. Further instructions can be found in BuildingFromCVS.
Build Instructions
Create a separate directory for the build, eg:
% cd ~/projects/InsightApplications-1.6.0 % mkdir Build % cd Build
Run CMake, pointing it at the top-level of the source directory:
% ccmake ..
The first time CMake comes up, you just need to press 'c' to perform the first-time configure step. This should find your compiler and other libraries. You may get a warning telling you that it is setting the CXX compiler to `g++` to match that imported from ITK; you can safely ignore this with 'e' and continue.
You are then presented with the first round of settings. Make the changes as summarised in the next section.
CMake Build Settings
The following settings are recommended to change from the default:
BUILD_SHARED_LIBS ON BUILD_TESTING OFF CMAKE_BUILD_TYPE Release USE_FLTK ON USE_VTK ON
Press 'c' again to configure this selection. If any of the libraries are not found in their default locations, you may get a warning, in which case you need to manually specify their locations. For example, on my system `VTK_DIR` comes up as `VTK_DIR-NOTFOUND` so I set it manually to `/usr/local/vtk/lib/vtk`.
Keep pressing 'c' to configure, and check any options that are highlighted with an asterisk '*'. Fill out any missing library locations, and eventually you will get the 'g' option enabled to generate the makefile.
Compiling
Assuming all the libraries were found, and the makefiles were generated, you can now you can start the compile:
% make
This can take quite some time, depending on the speed of your machine.
Installing
TBC: currently the applications do not install themselves, so running `make install` will have no effect.
Running
You can simply run the applications from where they have been compiled.
Note that it may be convenient to have certain commonly used applications (such as the `ImageViewer` available on your path.
A note about paths
Many applications use the common libraries found in `InsightApplications/Auxiliary`. These need to be found at runtime by the system, so you can either:
- add the directory to your `PATH` (under Windows) or `LD_LIBRARY_PATH` (under *nix systems), or
- under *nix, rely on the rpath option being set to hard-code in the executables the location of the extra libraries
Compiling FLTK-dependent components on Mac
MacPorts http://macports.org can be used to install the compatible version of FLTK on Mac (tested on Snow Leopard). This installs a 32-bit version of FLTK, since there seem to be known issues related to 64-bit install.
Because of this, ITK used in ITKApps also needs to be compiled in 32-bit mode. To do this, set the following flags before running cmake and configuring ITK, compile ITK, then use the same flags in ITKApps:
CXXFLAGS=-m32 CFLAGS=-m32
To compile ImageViewer, you need to enable FLTK and Auxiliary flags in CMake.
Finally, the png and jpeg libs installed by mac ports are not correctly resolved during linking ImageViewer. I pointed compiler explicitly to /opt/local/lib/lib{png|jpeg}.a to resolve this issue.