VTK/VTK 6 Migration/Removal of Execute

From KitwarePublic
Revision as of 17:25, 6 June 2012 by (talk) (fix apparent typo)
Jump to navigationJump to search

Removal of ExecuteInformation() and ExecuteData() from Algorithm Superclasses

Some of the algorithm superclasses such as vtkPointSetAlgorithm defined the ExecuteInformation() and ExecuteData() virtual functions. These were implemented in order to make transition from VTK 4 to 5 easy. However, none of the subclasses of these algorithms actually overwrote neither but overwrote RequestInformation() and RequestData() instead. To complete this transition, we removed ExecuteInformation() and ExecuteData() from the following superclasses:

  • vtkDataObjectAlgorithm
  • vtkGenericDataSetAlgorithm
  • vtkHyperOctreeAlgorithm
  • vtkPiecewiseFunctionAlgorithm
  • vtkPolyDataAlgorithm
  • vtkRectilinearGridAlgorithm
  • vtkSelectionAlgorithm
  • vtkStructuredGridAlgorithm
  • vtkUnstructuredGridAlgorithm

Any subclasses of the above classes that overrode ExecuteInformation() or ExecuteData() will have to changed to use RequestInformation() and RequestData(). You should also use this opportunity to use the input and output information objects to access input and output data objects, rather than using GetInput() and GetOutput(). Note that vtkImageAlgorithm still supports ExecuteData() and Execute().

Example 1


void vtkMyReader::ExecuteInformation()
   vtkImageData* output = this->GetOutput();


int vtkMyReader::RequestInformation(vtkInformation*, vtkInformationVector**, 
       vtkInformationVector* outInfoVec)
   vtkInformation* outInfo = outInfoVec->GetInformationObject(0);
   outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), );
       outInfo, VTK_UNSIGNED_CHAR, 1);
   return 1;

Example 2


void vtkMyAlgorithm::Execute()

   vtkImageData* input= this->GetInput();
   vtkPolyData* output = this->GetOutput();


int vtkMyReader::RequestData(vtkInformation*, 
      vtkInformationVector**, inInfoVec, 
       vtkInformationVector* outInfoVec)
    vtkImageData* input = vtkImageData::GetData(inInfoVec[0]);
    vtkPolyData* output = vtkPolyData::GetData(outInfoVec);