VTK6 Migration Guide

From mitk.org
Revision as of 17:57, 6 December 2013 by MarcoNolden (talk | contribs)
Jump to navigation Jump to search

VTK6 Migration Guide

http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide

http://vtk.org/Wiki/VTK/VTK_6_Migration/Overview

FloatingPointType

vtkFloatingPointType has to be replaced with double

-    vtkFloatingPointType point[3];
+    double point[3];


versionMacros

When vtk version macros (like VTK_MAJOR_VERSION) are used, the following header has to be included:

+#include <vtkVersionMacros.h>


Pipeline changes

http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput

Example 1

anotherFilter->SetInput(aFilter->GetOutput());

should become

anotherFilter->SetInputConnection(aFilter->GetOutputPort());


Example 2

vtkDataObject* output = aFilter->GetOutput();
anotherFilter->SetInput(output);

should become

anotherFilter->SetInputConnection(aFilter->GetOutputPort());

Example 3

vtkPolyData *pd = vtkPolyData::New();
aFilter->SetInput(pd);

should become

vtkPolyData *pd = vtkPolyData::New();
aFilter->SetInputData(pd);

Update on vtkData

Since vtkData Objects no longer have a source, the update method is not existing anymore. Instead, call the update method of the source directly.

CxxRevisionMacro

Deprecated Macro. Just remove it.

-vtkCxxRevisionMacro(vtkPVAxesActor, "$Revision$");


vtkTypeRevisionMacro

Renamed macro

-  vtkTypeRevisionMacro(vtkPVAxesActor,vtkProp3D);
+  vtkTypeMacro(vtkPVAxesActor,vtkProp3D);


allocateScalars

Example 1

Replace

int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**, 
       vtkInformationVector* outInfoVec)
{
   vtkImageData* output = this->GetOutput();
   output->GetScalarType();
   output->GetNumberOfScalarComponents();

with

int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**, 
       vtkInformationVector* outInfoVec)
{
    vtkInformation* outInfo = outInfoVec->GetInformationObject(0);
    vtkImageData::GetScalarType(outInfo);
    vtkImageData::GetNumberOfScalarComponents(outInfo);

Example 2

int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**, 
       vtkInformationVector* outInfoVec)
{
vtkImageData* output = vtkImageData::GetData(outInfoVec);
// Allocate output scalars here
output->GetScalarType();
output->GetNumberOfScalarComponents();

This code does not need to be changed.