SCM

VTK

From Forge Wiki

Jump to: navigation, search


The Visualization Toolkit (VTK), is an open-source C++ class library, freely available software system for 3D computer graphics, image processing and visualization. VTK is used by CamiTK to enable 3D data visualization.

Contents

Linux

VTK Versions supported in CamiTK on Linux system
CamiTK versions 3.5.x 4.x
VTK versions supported 5.10.x 6.x

For any questions about the versions supported, check out our external libraries policy.

On (Debian based) Linux, installation is pretty simple since precompiled libraries of ITK exist. Simply type in a console:

For VTK 5.10.x

sudo apt-get install libvtk5-dev libvtkXX-qt4-dev


Replace xx by the minor version of VTK library that is provided by your distrib.

For VTK 6.x

sudo apt-get install libvtk6-dev libvtk6-qt-dev

Windows

VTK Versions supported

CamiTK 3.5.x

If you are using CamiTK 3.5.x version, you use Qt 4.8.x version and you will need VTK 5.10.x version.


CamiTK 4.x

If you are using CamiTK 4.x version, you use Qt 5.x version and you will need VTK 6.x version.

For any question about the versions supported, check out our external libraries policy.

Visual Studio

VTK binaries are provided within the All in on installer You may check this out.

If you don't want to use the All in on installer, then you will have to compile yourself the VTK source.

  • Download the VTK source code according to your version of Visual Studio.

Remember to choose the corresponding VTK version according to your Visual Studio version (2013 or 2015) which is set according to the CamiTK version your are working with (3.5.x or 4.x).

  • Then, configure VTK with the following CMake options, depending on the CamiTK version:

Configure VTK 5.x for MSVC 2013 (CamiTK 3.5.x / Qt 4.8.x)

cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_DEBUG_POSTFIX="-debug" -DBUILD_DOCUMENTATION=FALSE -DBUILD_EXAMPLES=FALSE -DBUILD_SHARED_LIBS=TRUE -DBUILD_TESTING=FALSE -DVTK_USE_GL2PS=TRUE -DVTK_USE_GUISUPPORT=TRUE -DVTK_USE_QT=TRUE -DVTK_USE_SYSTEM_GL2PS=FALSE -DCMAKE_INSTALL_PREFIX="..\install" ..\src

Configure VTK 6.x (or 7.x) for MSVC 2015 (CamiTK 4.x / Qt 5.6 and above)

Notes:

  1. On Windows, there is a VTK bug that prevent the installation of VTK 6 or VTK 7 debug version, see this page on the CamiTK wiki page to fix this problem.
  2. As we decided to have the best possible C++11 support (as of the time of the CamiTK 4.0 release), MSVC 2015 was chosen as the supported compiler on the windows. Qt binaries for MSVC 2015 only starts with Qt 5.6. Therefore Qt 5.6 is the minimal version for CamiTK on Windows.

In order to solve the VTK debug version bug, you need to

  1. modify one cmake file in the VTK source directory
  2. use the correct option to configure VTK.

1) Modify one cmake file in the VTK source directory

Edit GUISupport\Qt\PluginInstall.cmake.in and replace all the lines with the following text:

  1. # Configured file and directory locations.
  2. SET(VTK_LIB_DIR "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
  3. SET(VTK_INSTALL_QT_DIR "@VTK_INSTALL_QT_DIR@")
  4. SET(VTK_INSTALL_QT_PLUGIN_DIR "@VTK_INSTALL_QT_PLUGIN_DIR@")
  5.  
  6. #Fix postfix problem when using a specific CMAKE_DEBUG_POSTFIX (e.g. in CamiTK, postfix is "-debug" )
  7. SET(VTK_INSTALL_QT_PLUGIN_FILE "@CMAKE_SHARED_LIBRARY_PREFIX@QVTKWidgetPlugin@CMAKE_SHARED_LIBRARY_SUFFIX@")
  8. SET(VTK_INSTALL_QT_PLUGIN_FILE_DEBUG "@CMAKE_SHARED_LIBRARY_PREFIX@QVTKWidgetPlugin@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
  9.  
  10. SET(VTK_CONFIGURATIONS "@CMAKE_CONFIGURATION_TYPES@")
  11.  
  12. IF(VTK_CONFIGURATIONS)
  13.   SET(VTK_LIBSUBDIR "/${BUILD_TYPE}")
  14. ENDIF()
  15.  
  16. # Install the file to the specified location.
  17. if(EXISTS "${VTK_LIB_DIR}${VTK_LIBSUBDIR}/${VTK_INSTALL_QT_PLUGIN_FILE}")
  18.     FILE(INSTALL DESTINATION "${VTK_INSTALL_QT_PLUGIN_DIR}" TYPE SHARED_LIBRARY
  19.         FILES "${VTK_LIB_DIR}${VTK_LIBSUBDIR}/${VTK_INSTALL_QT_PLUGIN_FILE}")
  20. endif()
  21. if(EXISTS "${VTK_LIB_DIR}${VTK_LIBSUBDIR}/${VTK_INSTALL_QT_PLUGIN_FILE_DEBUG}")
  22.     FILE(INSTALL DESTINATION "${VTK_INSTALL_QT_PLUGIN_DIR}" TYPE SHARED_LIBRARY
  23.         FILES "${VTK_LIB_DIR}${VTK_LIBSUBDIR}/${VTK_INSTALL_QT_PLUGIN_FILE_DEBUG}")
  24. endif()

2) Use the correct option to configure VTK

The qtwebkit module was removed starting from Qt 5.6 This makes the VTK configuration quite tricky. We advice to use the cmake command-line to properly configure VTK.

For VTK6 (supported version in CamiTK 4.x), use:

cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_DEBUG_POSTFIX="-debug" -DBUILD_DOCUMENTATION=FALSE -DBUILD_EXAMPLES=FALSE -DBUILD_SHARED_LIBS=TRUE -DBUILD_TESTING=FALSE -DVTK_Group_Qt=FALSE -DVTK_QT_VERSION=5 -DModule_vtkGUISupportQt=TRUE -DModule_vtkGUISupportQtOpenGL=TRUE -DModule_vtkGUISupportQtSQL=TRUE -DModule_vtkGUISupportQtWebkit=FALSE -DCMAKE_INSTALL_PREFIX="c:\dev\VTK\6.3" -DVTK_RENDERING_BACKEND=OpenGL ../src

For VTK7 (works, but not supported), use:

cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_DEBUG_POSTFIX="-debug" -DBUILD_DOCUMENTATION=FALSE -DBUILD_EXAMPLES=FALSE -DBUILD_SHARED_LIBS=TRUE -DBUILD_TESTING=FALSE -DVTK_Group_Qt=TRUE -DVTK_QT_VERSION=5 -DModule_vtkGUISupportQt=TRUE -DModule_vtkGUISupportQtOpenGL=TRUE -DModule_vtkGUISupportQtSQL=TRUE -DModule_vtkgl2ps=TRUE -DCMAKE_INSTALL_PREFIX="c:\dev\VTK\6.3" -DVTK_RENDERING_BACKEND=OpenGL ../src

Compile and install VTK

Once the configuration phase is finished:

  • Open the VTK.sln Visual Studion solution.
  • Compile and install it in Debug and Release.
  • The install directory now contains your VTK binaries
  • Enjoy!
Powered By FusionForge