VTK/VTK 6 Migration/Removal of Execute: Difference between revisions

From KitwarePublic
< VTK
Jump to navigationJump to search
(Created page with "Some of the algorithm superclasses such as vtkPointSetAlgorithm defined the ExecuteInformation() and ExecuteData() virtual functions. These were implemented in order to make tran...")
 
No edit summary
Line 1: Line 1:
= 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:
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:



Revision as of 14:25, 6 April 2012

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

Replace

<source lang="cpp"> void vtkMyReader::ExecuteInformation() {

  vtkImageData* output = this->GetOutput();
  output->SetWholeExtent(…);
  output->SetScalarType(VTK_UNSIGNED_CHAR);

} </source>

with

<source lang="cpp"> int vtkMyReader::RequestInformation(vtkInformation*, vtkInformationVector**,

      vtkInformationVector* outInfoVec)

{

  vtkInformation* outInfo = outInfoVec->GetInformationObject(0);
  outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), …);
   vtkDataObject::SetPointDataActiveScalarInfo(
      outInfo, VTK_UNSIGNED_CHAR, 1);
  return 1;

} </source>

Example 2

Replace

<source lang="cpp"> void vtkMyAlgorithm::Execute() {

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

</source>

with

<source lang="cpp"> int vtkMyReader::RequestInformation(vtkInformation*,

     vtkInformationVector**, inInfoVec, 
      vtkInformationVector* outInfoVec)

{

   vtkImageData* input = vtkImageData::GetData(inInfoVec[0]);
   vtkPolyData* output = vtkPolyData::GetData(outInfoVec);

</source>