From KitwarePublic
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

If you want to use ITK Examples you have several options. If you are a Wiki Example Developer, go here or a Wiki Example Administrator go here.

Build a single example

  1. Follow the instructions at the bottom of the example. These instructions tell how to download, extract, configure, compile and run the example.

From here, the instructions are operating system specific:


From your build directory, run

ccmake YourSourceDirectory (to create a Unix Makefile)


ccmake YourSourceDirectory -G YourIDE (e.g. KDevelop3)
  1. Press 'c' to configure.
  2. If CMake finds the correct location of your VTK binary build (the VTK_DIR cmake variable), and/or the ITK binary build (the ITK_DIR cmake variable) great! If not, use the arrow keys to scroll down to VTK_DIR, press enter, type the location of your VTK binary build (likely something like /home/yourname/bin/VTK), and press enter.
  3. Press 'c' again to reconfigure
  4. Press 'g' to generate
  5. If you generated a Unix Makefile, type 'make' in your build directory
  6. If you generated a project for an IDE, open the project file with your IDE


  1. Open CMake
  2. Select your CMakeLists.txt file
  3. Select your build system
  4. Click "Generate"

Build all of the examples

If you are really excited about learning ITK and are tired of downloading individual examples over and over, you can download them all at the same time and build them all together.

Unzip the zip file to ITKWikiExamples.
  • Keep an active connection to the examples.
  1. Install git
  2. Clone the examples repository
git clone ITKWikiExamples

You have your own versions of VTK and ITK

  • Make a directory to hold the binaries
mkdir ITKWikiExamples-build
  • From this build directory, run 'cmake'. You will be prompted for the location of your VTK and ITK binary builds.
cd ITKWikiExamples-build
ccmake ../ITKWikiExamples

Use the Superbuild to build a proper VTK and ITK

The ITKWikiExamples Superbuild will grab the proper versions of VTK and ITK and build all of the examples. To take advantage of the Superbuild, you will need to install git.

mkdir ITKWikiExamples-Superbuild
  • From this build directory, run 'ccmake'.
cd ITKWikiExamples-Superbuild
ccmake ../ITKWikiExamples/Superbuild

Build as an ITKv4 Remote Module

  • Enable fetching
  1. Go to:
  2. Right click on the "Raw" button and select "Save Link As..."
  3. Save the file in: YOUR_ITK_SOURCE_DIR/Modules/Remote

If you use an interactive cmake (ccmake, cmake-gui or cmakesetup)

  • Configure
  1. Go to your itk build directory and run cmake
  2. Configure
  • Fetch ITK Wiki Examples NOTE: Only for ITK 4.4 and earlier
  1. Open the highlighted (red) cmake entry
  2. Check the Fetch_WikiExamples box
  3. Configure
  • Enable ITK Wiki Exampes
  1. Configure (yes, do it again)
  2. Open the highlighted (red) cmake entry
  3. Check the Module_WikiExamples box
  4. Configure
  5. Generate
  6. Exit cmake

If you use cmake from the command line

From your itk build directory

  • Configure
  1. cmake -DFetch_WikiExamples=ON YOUR_ITK_SOURCE_DIR NOTE: Only for ITK 4.4 and earlier
  2. cmake -DModule_WikiExamples=ON YOUR_ITK_SOURCE_DIR

Once you have configured with the cmake gui or command line

  • Build ITKWikiExamples
 From your itk build directory
  1. make
  • Test ITKWikiExamples if testing is ON
  1. cd your itk build directory
  2. cd Modules/Remote/WikiExamples
  3. ctest

Find a class or method using google

Type the following into the google search bar itkMedianImageFilter
or SetRadius

Update the examples repository

If you cloned the examples repository, you can get the latest updates:

cd ITKWikiExamples
git pull
cd ../ITKWikiExamples-build
cmake ../ITKWikiExamples

Run all of the examples