Notice

This example has only been tested with the specific versions of the libraries detailed below. Newer versions of any libraries may not work.

Pre-requisites

1. Qt 4.8

Qt is a cross-platform, open source application developing toolkit that makes user interface development in C++ relatively simple. Download Qt 4.8 libraries for your compiler of choice. You may download the SDK if you wish, but note that the Windows SDK comes with MingW binaries only.

2. CMake

CMake is a build tool that makes cross-platform project organization simpler. You create a single project description (CMakeLists.txt) and CMake will generate a compiler-specific project specification from there. Download the latest version.

3. VTK 5.8.0

VTK is a C++ visualization library that has a large set of visualization techniques available. To compile VTK with Qt support, first download the VTK 5.8.0 source code (not the installer) and unzip to a directory of your choice. Create a build directory outside of the source code directory. You now have two directories, for example:

Run the CMake GUI and give it the paths to your source and build directories. Click "configure". In Windows, you will need to now indicate which compiler you will use. When this is finished, ou will need to update two build options:

Click "configure". CMake will run for awhile and then report that it cannot locate the Qt libraries. You will now need to update a third build option to indicate the path of qmake, which comes with Qt. For example:

Click "configure" again. When this is done, click "generate" to generate, for example, your Visual Studio solution file. Using the example paths we used before, you will find that file here:

You can now build VTK as you would any other C++ project with your compiler. Where applicable, select the Release build configuration.

Compilation

The example code can be compiled with CMake. Download the source archive and unarchive it into a directory of your choice. Create a build directory somewhere outside of the build directory. For example:

When running CMake, you will only need to update the VTK_DIR option to point to the build directory of VTK. For example:

After compiling the resulting project, you should have an executable named VolumeDemoApp. To run this application, all of the related dynamic library files must be available in your environment PATH. Specifically, this means that the Qt and VTK binary directories must be added to your PATH. For example:

Alternatively, but less desirably, copy all of the dll/dylib/so files from the above directories into the directory containing the VolumeDemoApp executable.