Building ITK

Gcc Note

If using gcc 3.3 be sure the command gcc -v yields build number 1671. If the build number is 1666 then gcc must be updated with Apple's November2004GCCUpdater package, available from Apple's Developer Connection page.

CMake is a program that generates ITK's makefiles. After running cmake, make must be invoked to build ITK.

To build ITK, first unpack its source code tarball. The following command creates directory InsightToolkit-x.x.x:

tar -x -z -f InsightToolkit-x.x.x.tar.gz
      

Create an ITK binary directory and cd to it:

mkdir InsightToolkit-x.x.x-bin
cd InsightToolkit-x.x.x-bin
      

Run cmake as follows:

cmake path-to-itk-source-directory \
 -DBUILD_EXAMPLES:BOOL=OFF \
 -DBUILD_SHARED_LIBS:BOOL=ON \
 -DBUILD_TESTING:BOOL=OFF \
 -DITK_USE_SYSTEM_PNG:BOOL=ON \
 -DPNG_LIBRARY:STRING=path-to-png-lib \
 -DPNG_PNG_INCLUDE_DIR:STRING=path-png-include-directory
      

Above, replace path-to-itk-source-directory with the path to the ITK source code directory (e.g. ../InsightToolkit-x.x.x). Replace path-to-png-lib with the path to the PNG library, typically /sw/lib/libpng.a. Replace path-png-include-directory with the path to a directory containing PNG header (include or .h) files, typically /sw/include.

After cmake completes, type:

make  
      

to build ITK. This builds ITK libraries in the ITK binary directory. SCIRun will use the ITK libraries in the ITK binary directory by providing SCIRun's configure command with option --with-insight=path-to-itk-binary-directory.

Alternatively, ITK can be installed in /usr/local/ by typing:

make install  
      

This installs ITK libraries in /usr/local/lib/InsightToolkit. SCIRun will use these libraries by providing SCIRun's configure command with option --with-insight=/usr/local/lib/InsightToolkit.