Difference between revisions of "Documentation/Nightly/Developers/Tutorials/MigrationGuide/VTK5-to-VTK6"
From Slicer Wiki
(Created page with "== Migration Guide == 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 Gui...") |
|||
Line 1: | Line 1: | ||
− | == Migration | + | <noinclude>__TOC__</noinclude> |
+ | ==Migration guide: Transition from VTK5 to VTK6== | ||
This section documents required change to make Slicer code work with VTK6. | This section documents required change to make Slicer code work with VTK6. |
Revision as of 22:28, 30 August 2018
Home < Documentation < Nightly < Developers < Tutorials < MigrationGuide < VTK5-to-VTK6Contents
Migration guide: 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