VTK6 Migration Guide

From mitk.org
Jump to navigation Jump to search


VTK Documentation


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

VTk Docu


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.