VTK/VTK 6 Migration/Removal of SetWholeExtent

From KitwarePublic
< VTK
Revision as of 19:08, 6 April 2012 by Berk (talk | contribs) (→‎Removal of SetWholeExtent() from vtkDataObject)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Removal of SetWholeExtent() from vtkDataObject

VTK 6 introduces a number of backwards-incompatible changes. The reasons behind these changes are described in more detail here. One of these changes is the removal of all pipeline related methods from vtkDataObject. Among these methods is SetWholeExtent(). SetWholeExtent() was previously (correctly) used to set meta-data about the whole available extent of a structured dataset in RequestInformation() and (incorrectly) used to try to set the actual extent of a structured dataset. The first use case can be replaced with the setting of the WHOLE_EXTENT() in the output information and the second one can be safely removed.

Example 1

Replace

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

      vtkInformationVector* outInfoVec)

{

  vtkImageData* image = this->GetOutput();
  int wext[6] = {0, 10, 0, 10, 0, 10};
  image->SetWholeExtent(wext);
  return 1;

} </source>

with

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

      vtkInformationVector* outInfoVec)

{

  vtkInformation* outInfo = outInfoVec->GetInformationObject(0);
  int wext[6] = {0, 10, 0, 10, 0, 10};
  outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wext, 6);
  return 1;

} </source>

Example 2

If outside RequestInformation, replace

<source lang="cpp"> int wext[6] = {0, 10, 0, 10, 0, 10}; image->SetExtent(wext); image->SetWholeExtent(wext); </source>

with

<source lang="cpp"> int wext[6] = {0, 10, 0, 10, 0, 10}; image->SetExtent(wext); </source>