VTK/VTK 6 Migration/Change to Crop

From KitwarePublic
< VTK
Jump to navigationJump to search

Change to Crop() in 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 functionality from vtkDataObject. Prior to VTK 6, vtkDataObject’s Crop() method used the update extent stored in the pipeline information. Since a data object no longer has access to the pipeline information, we change Crop() to take the update extent as an argument

Example 1

Replace

<source lang="cpp"> int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**,

      vtkInformationVector* outInfoVec)

{

  vtkImageData* output = this->GetOutput();
  // Do something with image data
  output->Crop();

</source>

with

<source lang="cpp"> int vtkMyAlg::RequestData(vtkInformation*, vtkInformationVector**,

      vtkInformationVector* outInfoVec)

{

  vtkInformation* outInfo = outInfoVec->GetInformationObject(0);
  vtkImageData* output = vtkImageData::GetData(outInfo);
  // Do something with image data
  output->Crop(
      outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT());

</source>