Difference between revisions of "VTK6 Migration Guide"
(username removed) |
m |
||
| (5 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
| − | = | + | == VTK Documentation == |
| − | http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide | + | * [http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide VTK6 Migration Guide] |
| − | http://vtk.org/Wiki/VTK/VTK_6_Migration/Overview | + | * [http://vtk.org/Wiki/VTK/VTK_6_Migration/Overview VTK6 Migration Overview] |
| + | |||
| + | |||
| + | == FloatingPointType == | ||
| + | vtkFloatingPointType has to be replaced with double | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | - vtkFloatingPointType point[3]; | ||
| + | + double point[3]; | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | == versionMacros == | ||
| + | When vtk version macros (like VTK_MAJOR_VERSION) are used, the following header has to be included: | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | +#include <vtkVersionMacros.h> | ||
| + | </syntaxhighlight> | ||
| − | |||
== Pipeline changes == | == Pipeline changes == | ||
| + | [http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput| VTk Docu] | ||
| + | |||
| + | |||
| + | === Example 1 === | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | anotherFilter->SetInput(aFilter->GetOutput()); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | should become | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | anotherFilter->SetInputConnection(aFilter->GetOutputPort()); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | === Example 2 === | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | vtkDataObject* output = aFilter->GetOutput(); | ||
| + | anotherFilter->SetInput(output); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | should become | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | anotherFilter->SetInputConnection(aFilter->GetOutputPort()); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | === Example 3 === | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | vtkPolyData *pd = vtkPolyData::New(); | ||
| + | aFilter->SetInput(pd); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | should become | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | vtkPolyData *pd = vtkPolyData::New(); | ||
| + | aFilter->SetInputData(pd); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | === 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. | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | -vtkCxxRevisionMacro(vtkPVAxesActor, "$Revision$"); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | == vtkTypeRevisionMacro == | ||
| + | Renamed macro | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | - vtkTypeRevisionMacro(vtkPVAxesActor,vtkProp3D); | ||
| + | + vtkTypeMacro(vtkPVAxesActor,vtkProp3D); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | == allocateScalars == | ||
| + | |||
| + | |||
| + | === Example 1 === | ||
| + | Replace | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**, | ||
| + | vtkInformationVector* outInfoVec) | ||
| + | { | ||
| + | vtkImageData* output = this->GetOutput(); | ||
| + | output->GetScalarType(); | ||
| + | output->GetNumberOfScalarComponents(); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | with | ||
| + | |||
| + | <syntaxhighlight lang="cpp"> | ||
| + | int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**, | ||
| + | vtkInformationVector* outInfoVec) | ||
| + | { | ||
| + | vtkInformation* outInfo = outInfoVec->GetInformationObject(0); | ||
| + | vtkImageData::GetScalarType(outInfo); | ||
| + | vtkImageData::GetNumberOfScalarComponents(outInfo); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | === Example 2 === | ||
| + | <syntaxhighlight lang="cpp"> | ||
| + | int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**, | ||
| + | vtkInformationVector* outInfoVec) | ||
| + | { | ||
| + | vtkImageData* output = vtkImageData::GetData(outInfoVec); | ||
| + | // Allocate output scalars here | ||
| + | output->GetScalarType(); | ||
| + | output->GetNumberOfScalarComponents(); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | This code does not need to be changed. | ||
Latest revision as of 16:10, 4 December 2014
VTK Documentation
FloatingPointType
vtkFloatingPointType has to be replaced with double
<syntaxhighlight lang="cpp"> - vtkFloatingPointType point[3]; + double point[3]; </syntaxhighlight>
versionMacros
When vtk version macros (like VTK_MAJOR_VERSION) are used, the following header has to be included:
<syntaxhighlight lang="cpp"> +#include <vtkVersionMacros.h> </syntaxhighlight>
Pipeline changes
Example 1
<syntaxhighlight lang="cpp"> anotherFilter->SetInput(aFilter->GetOutput()); </syntaxhighlight>
should become
<syntaxhighlight lang="cpp"> anotherFilter->SetInputConnection(aFilter->GetOutputPort()); </syntaxhighlight>
Example 2
<syntaxhighlight lang="cpp"> vtkDataObject* output = aFilter->GetOutput(); anotherFilter->SetInput(output); </syntaxhighlight>
should become
<syntaxhighlight lang="cpp"> anotherFilter->SetInputConnection(aFilter->GetOutputPort()); </syntaxhighlight>
Example 3
<syntaxhighlight lang="cpp"> vtkPolyData *pd = vtkPolyData::New(); aFilter->SetInput(pd); </syntaxhighlight>
should become
<syntaxhighlight lang="cpp"> vtkPolyData *pd = vtkPolyData::New(); aFilter->SetInputData(pd); </syntaxhighlight>
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.
<syntaxhighlight lang="cpp"> -vtkCxxRevisionMacro(vtkPVAxesActor, "$Revision$"); </syntaxhighlight>
vtkTypeRevisionMacro
Renamed macro
<syntaxhighlight lang="cpp"> - vtkTypeRevisionMacro(vtkPVAxesActor,vtkProp3D); + vtkTypeMacro(vtkPVAxesActor,vtkProp3D); </syntaxhighlight>
allocateScalars
Example 1
Replace
<syntaxhighlight lang="cpp"> int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**,
vtkInformationVector* outInfoVec)
{
vtkImageData* output = this->GetOutput(); output->GetScalarType(); output->GetNumberOfScalarComponents();
</syntaxhighlight>
with
<syntaxhighlight lang="cpp"> int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**,
vtkInformationVector* outInfoVec)
{
vtkInformation* outInfo = outInfoVec->GetInformationObject(0); vtkImageData::GetScalarType(outInfo); vtkImageData::GetNumberOfScalarComponents(outInfo);
</syntaxhighlight>
Example 2
<syntaxhighlight lang="cpp"> int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**,
vtkInformationVector* outInfoVec)
{ vtkImageData* output = vtkImageData::GetData(outInfoVec); // Allocate output scalars here output->GetScalarType(); output->GetNumberOfScalarComponents(); </syntaxhighlight>
This code does not need to be changed.