Difference between revisions of "Documentation/Labs/VTK8"

From Slicer Wiki
Jump to: navigation, search
Line 53: Line 53:
 
* http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1052932 (Release configuration, OpenGL backend, Ubuntu 16.04)
 
* http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1052932 (Release configuration, OpenGL backend, Ubuntu 16.04)
 
** py_nomainwindow_SlicerOptionDisableSettingsTest passed when re-run.
 
** py_nomainwindow_SlicerOptionDisableSettingsTest passed when re-run.
** py_StandaloneEditorWidgetTest is vtkDebugLeaks; perhaps a valid issue, but unrelated to this change.
+
** py_StandaloneEditorWidgetTest is vtkDebugLeaks; perhaps unrelated to this change.
  
 
<b>OS X:</b>
 
<b>OS X:</b>

Revision as of 19:55, 29 June 2017

Home < Documentation < Labs < VTK8

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

Overview

It is planned to update the version of VTK that Slicer uses from 7.1 to 8.0.

Status

  • Builds on Linux and Windows; Mac is untested. Test runs are in progress.
  • Running on Windows gives OpenGL errors at exit with the OpenGL backend. The OpenGL2 backend is untested.
  • "VTKv7" project name needs to be updated to "VTKv8".
  • EMSegment remote module will require updates to fix vtkDebugLeaks output. (updated in r17131)

Branches/Merge Requests

VTK:

Slicer:

Outstanding VTK issues

Slicer-specific VTK commits

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

Tests

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

Windows:

Test results:

  • TBD

Linux:

Test results:

OS X:

Test results:

  • TBD

Rendering backend

Although VTK 7 changed 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

Open

Discussion

The transition plan was announced on the Slicer forum: https://discourse.slicer.org/t/transition-to-vtk-8-0/379.

Migration guide

This section lists categories of code changes necessary to build and run Slicer with VTK 8.0. Each category has a short description, a suggested upgrade path, and references to relevant commits (TBD once merged).

Use hierarchy files for VTK Python wrapping

In VTK8 it's necessary to generate hierarchy files for proper wrapping VTK classes in Python. Without the information provided by the hierarchy files, the Python wrapping tool lacks complete information about classes and types. In this case, the generated classes contain methods that shouldn't be wrapped and fail to compile, and include references to types such as vtkTypeBool. Once the hierarchy files are generated and provided to the Python wrapping tool, the generated classes compile and typedefs like vtkTypeBool are correctly resolved.

Once the VTK8 changes are merged, generating hierarchy files is handled by https://github.com/Slicer/Slicer/blob/master/CMake/vtkMacroKitPythonWrap.cmake.

References:

Call InitializeObjectBase() in vtkObject New() methods

In VTK8 it's necessary for vtkObject New() methods to call InitializeObjectBase() on the new object for proper tracking with vtkDebugLeaks. The standard macros (vtkStandardNewMacro, vtkObjectFactoryNewMacro) handle this. For those classes that don't use the macros, add a call to InitializeObjectBase() immediately after constructing the object by new vtkXXX().

Additionally, vtkObjectFactory::CreateInstance() now doesn't register the class name with vtkDebugLeaks if the factory fails to create the object. Therefore, it's no longer necessary to unregister the class name with vtkDebugLeaks. Remove calls to vtkDebugLeaks::DestructClass(className) following vtkObjectFactory::CreateInstance().

To support both VTK8 and earlier versions of VTK, wrap these changes in preprocessor checks for whether VTK_HAS_INITIALIZE_OBJECT_BASE is defined.

References:

Future work

Future work in Slicer related to VTK 8 could include:

  • Remove BTX/ETX markers.
  • Check for and resolve build warnings in Slicer VTK classes.
  • Check that settings in External_VTKv8.cmake are all still necessary, specifically VTK_USE_PARALLEL, and anything related to Qt.