Friedrich-Alexander-Universität
Friedrich-Alexander-Universität
Stanford Radiology

Wrap VTK

Wrapping VTK for Java support is relatively easy and straight forward compared to ITK wrapping, however, it is also less important as ImageJ already brings a lot of rendering capability to the table. Nevertheless it may be useful for mesh smoothing, coarsening, or similar applications.

VTK wrapping on Windows involves the following steps (the process is similar on Linux or Mac):

 

  1. Download and install Opens external link in new windowCMake 2.8 or 3.0 (has been tested with both)
  2. Download Opens external link in new windowVTK (we have tested 6.1)
  3. Extract the source code to .../VTK-6.1/src/ and configure the project using CMake. We configured the project for Visual Studio 2010 Professional, 64bit, and Release mode. Make sure to uncheck "Build examples" and "Build testing" for faster compilation. Check "Build shared libraries". Click configure.
  4. Check "VTK_WRAP_JAVA" and set the correct paths to your Java SDK installation (if your building for 64bit these need to be 64bit). Click configure again, and then generate
  5. Open the VS solution generated by CMake, right click the ALL_BUILD project, and click: build. The project should now compile. If everything was setup correctly, there should be no errors.
  6. Include the VTK binary directory in your PATH environment variable: ".../VTK-6.1/build/release/bin".
  7. Include ".../VTK-6.1/build/release/bin/vtk.jar" into your Java project and you should be good to go. 

Demo code and a more detailed tutorial can be found Opens external link in new windowhere.