Difference between revisions of "VTK6 Migration Guide"
Jump to navigation
Jump to search
(username removed) |
MarcoNolden (talk | contribs) |
||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
| − | = VTK6 Migration | + | <!-- ## page was renamed from internal/VTK6 --> |
| + | = VTK6 Migration Guide = | ||
http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide | http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide | ||
| + | |||
http://vtk.org/Wiki/VTK/VTK_6_Migration/Overview | http://vtk.org/Wiki/VTK/VTK_6_Migration/Overview | ||
| − | == | + | == [[FloatingPointType]] == |
| + | vtkFloatingPointType has to be replaced with double | ||
| + | |||
| + | <pre><nowiki> | ||
| + | - vtkFloatingPointType point[3]; | ||
| + | + double point[3]; | ||
| + | </nowiki></pre> | ||
| + | |||
| + | |||
| + | == versionMacros == | ||
| + | When vtk version macros (like VTK_MAJOR_VERSION) are used, the following header has to be included: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | +#include <vtkVersionMacros.h> | ||
| + | </nowiki></pre> | ||
| + | |||
== Pipeline changes == | == Pipeline changes == | ||
| + | http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput | ||
| + | === Example 1 === | ||
| + | |||
| + | <pre><nowiki> | ||
| + | anotherFilter->SetInput(aFilter->GetOutput()); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | should become | ||
| + | |||
| + | <pre><nowiki> | ||
| + | anotherFilter->SetInputConnection(aFilter->GetOutputPort()); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | |||
| + | === Example 2 === | ||
| + | |||
| + | <pre><nowiki> | ||
| + | vtkDataObject* output = aFilter->GetOutput(); | ||
| + | anotherFilter->SetInput(output); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | should become | ||
| + | |||
| + | <pre><nowiki> | ||
| + | anotherFilter->SetInputConnection(aFilter->GetOutputPort()); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | === Example 3 === | ||
| + | |||
| + | <pre><nowiki> | ||
| + | vtkPolyData *pd = vtkPolyData::New(); | ||
| + | aFilter->SetInput(pd); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | should become | ||
| + | |||
| + | <pre><nowiki> | ||
| + | vtkPolyData *pd = vtkPolyData::New(); | ||
| + | aFilter->SetInputData(pd); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | === 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. | ||
| + | |||
| + | <pre><nowiki> | ||
| + | -vtkCxxRevisionMacro(vtkPVAxesActor, "$Revision$"); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | |||
| + | == vtkTypeRevisionMacro == | ||
| + | Renamed macro | ||
| + | |||
| + | <pre><nowiki> | ||
| + | - vtkTypeRevisionMacro(vtkPVAxesActor,vtkProp3D); | ||
| + | + vtkTypeMacro(vtkPVAxesActor,vtkProp3D); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | |||
| + | == allocateScalars == | ||
| + | === Example 1 === | ||
| + | Replace | ||
| + | |||
| + | <pre><nowiki> | ||
| + | int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**, | ||
| + | vtkInformationVector* outInfoVec) | ||
| + | { | ||
| + | vtkImageData* output = this->GetOutput(); | ||
| + | output->GetScalarType(); | ||
| + | output->GetNumberOfScalarComponents(); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | with | ||
| + | |||
| + | <pre><nowiki> | ||
| + | int vtkMyAlg::RequestInformation(vtkInformation*, vtkInformationVector**, | ||
| + | vtkInformationVector* outInfoVec) | ||
| + | { | ||
| + | vtkInformation* outInfo = outInfoVec->GetInformationObject(0); | ||
| + | vtkImageData::GetScalarType(outInfo); | ||
| + | vtkImageData::GetNumberOfScalarComponents(outInfo); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | === Example 2 === | ||
| + | |||
| + | <pre><nowiki> | ||
| + | int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**, | ||
| + | vtkInformationVector* outInfoVec) | ||
| + | { | ||
| + | vtkImageData* output = vtkImageData::GetData(outInfoVec); | ||
| + | // Allocate output scalars here | ||
| + | output->GetScalarType(); | ||
| + | output->GetNumberOfScalarComponents(); | ||
| + | </nowiki></pre> | ||
| + | |||
| + | This code does not need to be changed. | ||
Revision as of 16:57, 6 December 2013
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.