BIOE 2630 Methods in Image Analysis

Assignment #1

E-mail me (Ken), Damion, or Aaron with questions or problems.

Before doing any ITK development, you will need to setup a working environment in which to compile your code. This includes

  1. Installing CMake
  2. Compiling & installing FLTK
  3. Compiling & installing VTK
  4. Compiling & installing ITK
For further guidance on these procedures and how to test your build environment, you may wish to consult the slides from Damion's first lecture.

1. Installing CMake

CMake can be downloaded from http://www.cmake.org/. The most recent version is 2.2.3. Binary installers are provided in the Download section of the CMake website. Installing CMake is relatively painless and you probably won't run into any problems here.

2. Compiling & Installing FLTK

FLTK can be found at http://www.fltk.org/. The latest stable release - and the one we recommend you download - is v1.1.6.

Download fltk-1.1.6-source.zip and extract its contents somewhere appropriate (e.g., I use C:\Lib in a Windows environment and /Developer under OS X). You may find it convenient to keep all of your downloaded libraries (i.e., ITK, VTK, etc.) in this same root directory. After extraction you will have the FLTK source tree residing at either C:\Lib\fltk-1.1.6 or /Developer/fltk-1.1.6.

To build with Visual Studio, you can open fltk.dsw workspace from the fltk-1.1.6/visualc/ directory. Once opened, simply build all projects in the workspace.

To build using the Xcode Tools suite under OS X, the easiest thing to do is open a Terminal window (found under Applications->Utilities) and change the directory to the location of the extracted sources i.e., by running the command:

cd /Developer/fltk-1.1.6

Once in this directory you should be able to execute the following command sequence:

./configure
make

Now on either system, after the build completes, your fltk-1.1.6 directory will contain the compiled binaries necessary for linking to FLTK.

NOTE: In the past FLTK has had some syntax problems that would make Xcode gcc unhappy, so it's highly possible that FLTK will fail compilation under OS X at some point. The fix is relatively simple, so if you encounter any problems please e-mail Ken with a copy of the error output. Similar minor issues may also arise when compiling VTK.

3. Compiling & Installing VTK

The VTK source code can be downloaded from http://www.vtk.org/ (under Get the Software). You want the latest official release (VTK-4.2-LatestRelease.zip). You also need the VTKData-4.2.zip file.

Extract both of these archives somewhere (e.g. to the same place you extracted FLTK).

Now run CMakeSetup, which should be in your Applications folder (or Start Menu) under CMake. You will first need to tell CMake what compiler system you are using. For the input (CMakeLists.txt) file, point to the directory where VTK has been extracted (e.g. C:\Lib\VTK). If you cannot use CMakeSetup (Linux and possible OS X), you can use the command-line tool ccmake by issuing the following command within your VTK source directory:

ccmake .

Note that the '.' is part of the command. Once either of these tools is running, you want to "configure" the system. This will cause cmake to establish environment settings for the build process. Once finished, you will be presented with a list of optional or unknown values for you to change as needed. You should turn on BUILD_EXAMPLES, BUILD_SHARED_LIBS, VTK_USE_HYBRID, VTK_USE_PARALLEL, and VTK_USE_PATENTED. Also set VTK_DATA_ROOT to the directory where the VTKData archive has been extracted (e.g., C:\Lib\VTKData).

Once these variables have been set, Configure again. Finally, you should be able to "Generate" the build environment.

On Windows, this will create a Visual Studio workspace that can be used for the build.

Under OS X or other UNIX-like systems, this should generate a Makefile. To use the Makefile, simply issue the make command from within the VTK directory.

4. Compiling & Installing ITK

The ITK source code is at http://www.itk.org/, on the Download page. You'll have to fill out a small form before continuing with the download, and once you reach the actual download page you want to grab InsightToolkit-2.4.1.zip.

Extract the archive.

Run CMakeSetup as you did with VTK, only this time point to the CMakeLists.txt within the InsightToolkit-2.4.1 folder. If using non-Windows, you will run the "ccmake ." command from within that folder.

Configure the system for the first time

Now you'll be presented with more options. Turn on BUILD_SHARED_LIBS. You may also wish to enable advanced options and then turn on ITK_USE_PATENTED in case you have interest in using any of the patented algorithms in ITK (e.g. fuzzy connectedness).

Configure again.

Generate.

Use the generated project or Makefile, as you did with VTK, to build the ITK binaries.

5. Rejoice...

...or curse at your compiler, depending on what happens throughout this whole process. Sometimes the compiler will simply give in to the pressure of a well-crafted insult and start doing what it's supposed to do. Usually not.

One thing you may try before contacting anyone is to ensure that your compiler system is up-to-date with the latest patches.

Microsoft publishes service packs for the Visual Studio suite that can be found at http://msdn.microsoft.com/.

Apple makes available the latest version of the Xcode Tools for download at http://developer.apple.com (may require setting up an account on the site - it's free).

If you are not using either of these systems, or you still run into compiler/linker errors after updating, please do not hesitate to copy and paste your errors to someone (preferrably me). If I can't help you, I'll find someone who can.

Good luck!