Difference between revisions of "VTK6 Migration Guide"

From mitk.org
Jump to navigation Jump to search
m (JasminMetzger moved page VTK6 to VTK6 Migration Guide)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
<!-- ## page was renamed from internal/VTK6 -->
 
<!-- ## page was renamed from internal/VTK6 -->
= VTK6 Migration Guide =
+
__NOTOC__
http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
 
  
http://vtk.org/Wiki/VTK/VTK_6_Migration/Overview
+
== VTK Documentation ==
 +
* [http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide VTK6 Migration Guide]
 +
* [http://vtk.org/Wiki/VTK/VTK_6_Migration/Overview VTK6 Migration Overview]
  
== [[FloatingPointType]] ==
+
 
 +
== FloatingPointType ==
 
vtkFloatingPointType has to be replaced with double
 
vtkFloatingPointType has to be replaced with double
  
Line 24: Line 26:
  
 
== Pipeline changes ==
 
== Pipeline changes ==
http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput
+
[http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput| VTk Docu]
 +
 
 +
 
 
=== Example 1 ===
 
=== Example 1 ===
  
Line 50: Line 54:
 
anotherFilter->SetInputConnection(aFilter->GetOutputPort());
 
anotherFilter->SetInputConnection(aFilter->GetOutputPort());
 
</nowiki></pre>
 
</nowiki></pre>
 +
  
 
=== Example 3 ===
 
=== Example 3 ===
Line 64: Line 69:
 
aFilter->SetInputData(pd);
 
aFilter->SetInputData(pd);
 
</nowiki></pre>
 
</nowiki></pre>
 +
  
 
=== Update on vtkData ===
 
=== 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.
 
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]] ==
+
 
 +
== CxxRevisionMacro ==
 
Deprecated Macro. Just remove it.
 
Deprecated Macro. Just remove it.
  
Line 86: Line 93:
  
 
== allocateScalars ==
 
== allocateScalars ==
 +
 +
 
=== Example 1 ===
 
=== Example 1 ===
 
Replace
 
Replace
Line 108: Line 117:
 
     vtkImageData::GetNumberOfScalarComponents(outInfo);
 
     vtkImageData::GetNumberOfScalarComponents(outInfo);
 
</nowiki></pre>
 
</nowiki></pre>
 +
  
 
=== Example 2 ===
 
=== Example 2 ===
 
 
<pre><nowiki>
 
<pre><nowiki>
 
int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**,  
 
int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**,  

Revision as of 15:00, 22 October 2014


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.