Difference between revisions of "Documentation/Labs/VTK6"

From Slicer Wiki
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 13: Line 13:
 
* [http://www.vtk.org/Wiki/VTK/Build_System_Migration VTK_6 build system Migration Guide]
 
* [http://www.vtk.org/Wiki/VTK/Build_System_Migration VTK_6 build system Migration Guide]
  
== Migration Guide ==
+
{{:Documentation/Nightly/Developers/Tutorials/MigrationGuide/VTK5-to-VTK6}}
 
 
This section documents required change to make Slicer code work with VTK6.
 
 
 
* See [http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide VTK_6 Migration Guide]
 
  
 
== Progress ==
 
== Progress ==
  
 
* {{done}} VTK6 has been integrated into Slicer trunk. It is disabled by default. To enable it, pass the option <code>-DVTK_VERSION_MAJOR:STRING=6</code>
 
* {{done}} VTK6 has been integrated into Slicer trunk. It is disabled by default. To enable it, pass the option <code>-DVTK_VERSION_MAJOR:STRING=6</code>
 +
** Using ccmake and setting the VTK_VERSION_MAJOR variable does not seem to work.  The first "generation" in ccmake, causes a VTKv5 structure to be created which is not overwritten by subsequent runs with VTK_VERSION_MAJOR changed.  I had to remove the VTKv5 directories from the build and run cmake as described above with -DVTK_VERSION_MAJOR:STRING=6. - Jim
  
 
* <del>See https://docs.google.com/a/kitware.com/document/d/1tT4VBJtt6U0LUEyaNaW7hJIVbb2XqBdyEbQyfsmUq9I </del>
 
* <del>See https://docs.google.com/a/kitware.com/document/d/1tT4VBJtt6U0LUEyaNaW7hJIVbb2XqBdyEbQyfsmUq9I </del>

Latest revision as of 15:57, 16 October 2017

Home < Documentation < Labs < VTK6

This page will document experiments related to the upgrade of Slicer base to VTK6.

References

Experiments

Build System


Transition from VTK5 to VTK6

This section documents required change to make Slicer code work with VTK6.


Use SetInputPolyDataConnection and GetPolyDataConnection

Starting with Slicer r24801, support for VTK5 API was removed and VTK6 API should be used.

Error message similar to:

error: ‘class vtkMRMLModelDisplayNode’ has no member named ‘SetInputPolyData’
 resultDisplay->SetInputPolyData(resultModel->GetPolyData());
                ^

Solution:

Replace occurrences of SetInputPolyData/GetPolyData with SetInputPolyDataConnection/GetPolyDataConnection.

Use AllocateScalars

Starting with Slicer r24801, support for VTK5 API was removed and VTK6 API should be used.

Error message similar to:

  error: no matching function for call to ‘vtkImageData::SetNumberOfScalarComponents(int)’
    mp_phi->SetNumberOfScalarComponents(1);
                                         ^

Solution:

Replace lines like:

 imageData->SetScalarTypeToUnsignedShort();		
 imageData->SetNumberOfScalarComponents(1); // image holds one value intensities		
 imageData->AllocateScalars(); // allocate storage for image data

with:

 imageData->AllocateScalars(VTK_UNSIGNED_SHORT, 1); // allocate storage for image data

Progress

  • Check.svg VTK6 has been integrated into Slicer trunk. It is disabled by default. To enable it, pass the option -DVTK_VERSION_MAJOR:STRING=6
    • Using ccmake and setting the VTK_VERSION_MAJOR variable does not seem to work. The first "generation" in ccmake, causes a VTKv5 structure to be created which is not overwritten by subsequent runs with VTK_VERSION_MAJOR changed. I had to remove the VTKv5 directories from the build and run cmake as described above with -DVTK_VERSION_MAJOR:STRING=6. - Jim