From Slicer Wiki
Revision as of 15:55, 16 October 2017 by JChris.FillionR (talk | contribs)
Jump to: navigation, search
Home < Documentation < Labs < VTK7

This page documents the update of Slicer to use VTK 7.1.


It is planned to update the version of VTK that Slicer uses from 6.3 to 7.1. Because VTK has deprecated various headers, classes, and methods, it may be necessary to update extension code to be compatible with the new version of VTK. Additionally, because VTK has expanded the scope of code that is Python-wrapped by default, it may be necessary to add new wrapping exclusions.

The following sections describe the status of the VTK update and specific issues that may impact extensions.


Merged in r25219 to r25227, or on GitHub, e0af614...929aed2.

Branches/Merge Requests



Outstanding VTK issues

Slicer-specific VTK commits

Slicer's VTK 7.1 branch includes fixes/changes that aren't in upstream:


NOTE: Following the transition to VTK7, this section is out of date.

This section lists test failures on each platform for Release builds.

Some commits that fix Slicer builds and tests have been merged upstream:



Test results:


Test results:

Rendering backend

Although VTK 7 changes the default setting of VTK_RENDERING_BACKEND to OpenGL2, Slicer still explicitly sets it to OpenGL. Using the OpenGL2 backend in Slicer is untested and may require updates to properly build and function. This rendering backend in Slicer is set using Slicer_VTK_RENDERING_BACKEND.

OpenGL2 backend known issues

Fixed upstream
  • Incorrect clipping seen during volume rendering. Fixed by VTK 1655 (Verified, but not yet in Slicer VTK branch). To reproduce:
    • Download MRHead in Sample Data.
    • Volume Render MRHead.
    • Rotate view with up arrow key. Observe incorrect clipping once rotated 90 degrees.
  • Issue 3969, OpenGL errors due to incorrect context active during cleanup, may still be issue. The test case in the bug seems fixed, but additional problems are likely fixed by VTK 1636 (Verified, but not yet in Slicer VTK branch).


The transition plan was announced on the slicer-devel mailing list:


List of extensions that may require updates

By examining the source code of Slicer extensions, it is likely that some extensions will require changes to be compatible with VTK 7.1. This section lists categories of updates and specific files in extensions that may need to be updated.

Use to fetch the source code of all extensions in the extensions index.

A useful regular expression to help identify uses of the deprecated vtkMatrix4x4 operator[] is:


However, note that this results in many false positives, because that syntax is valid for many classes.


  • DTIAtlasFiberAnalyzer/Applications/dtitractstat/fiberprocessing.cxx
  • DTIProcess/PrivateLibrary/fiberio.cxx
  • MarginCalculator/MotionSimulatorDoubleArray/MRML/vtkMRMLMotionSimulatorDoubleArrayNode.cxx
  • SPHARM-PDM/Applications/MetaMeshTools/MeshMath.cxx

Python wrapping:

    • SlicerPathology/QuickTCGA/Logic/CMakeLists.txt
    • SlicerPathology/ShortCutCore/Logic/CMakeLists.txt
    • FacetedVisualizer/Logic/vtkSlicerFacetedVisualizerLogic.h
    • FacetedVisualizer/qSlicerFacetedVisualizerModuleWidget.h
    • LightWeightRobotIGT/LightWeightRobotIGT/MRML/vtkIGTLToMRMLString.h
    • LightWeightRobotIGT/LightWeightRobotIGT/MRML/vtkMRMLIGTLSessionManagerNode.h
    • ModelClip/vtkPlaneExtend.h
    • SlicerRT/DicomRtImportExport/Logic/vtkSlicerDicomRtReader.h
    • SlicerRT/DicomRtImportExport/Logic/vtkSlicerDicomRtWriter.h
    • SlicerRT/DicomSroImport/Logic/vtkSlicerDicomSroReader.h
    • SlicerRT/SegmentationCore/vtkSegmentation.h
    • SlicerRT/Segmentations/MRML/vtkMRMLSegmentationNode.h
    • SlicerRT/SlicerRtCommon/SlicerRtCommon.h
    • SlicerRT/SlicerRtCommon/vtkCollisionDetectionFilter.h

References to VTKv6:

  • DTIPrep/SuperBuild/External_VTK.cmake
  • DTIPrep/SuperBuild/External_VTK_patch.cmake
  • SPHARM-PDM/SuperBuild/External_VTK.cmake
  • SPHARM-PDM/SuperBuild/External_VTK_patch.cmake
  • DTIAtlasBuilder/SuperBuild/FindExternalTools.cmake
  • DTIProcess/SuperBuild/External_VTK.cmake
  • DTIProcess/SuperBuild/External_VTK_patch.cmake
  • ShapePopulationViewer/SuperBuild/External_VTK_patch.cmake
  • ShapePopulationViewer/SuperBuild/External_VTK.cmake
  • FiberViewerLight/SuperBuild/External_VTK.cmake
  • FiberViewerLight/SuperBuild/External_VTK_patch.cmake
  • DTIAtlasFiberAnalyzer/SuperBuild/External_VTK.cmake

Future work

Future work in Slicer related to VTK 7 could include:

  • Remove BTX/ETX markers.
  • Resolve build warnings for -Woverloaded-virtual in Slicer VTK classes.
  • Check that settings in External_VTKv7.cmake are all still necessary, specifically VTK_USE_PARALLEL, and anything related to Qt.
  • Test Slicer_VTK_RENDERING_BACKEND set to OpenGL2.