VTK/VTK 6 Migration/Change to CopyOriginAndSpacingFromPipeline

From KitwarePublic
< VTK
Jump to navigationJump to search

Change to CopyOriginAndSpacingFromPipeline in vtkImageData

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 CopyOriginAndSpacingFromPipeline() method used the origin and spacing meta-data stored in the pipeline information. Since a data object no longer has access to the pipeline information, we change CopyOriginAndSpacingFromPipeline() to take pipeline information as an argument.

Example 1

Replace

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

      vtkInformationVector* outInfoVec)

{

  vtkImageData* output = this->GetOutput();
  output->CopyOriginAndSpacingFromPipeline();

</source>

with

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

      vtkInformationVector* outInfoVec)

{

  vtkInformation* outInfo = outInfoVec->GetInformationObject(0);
  vtkImageData* output = vtkImageData::GetData(outInfo);
  output->CopyOriginAndSpacingFromPipeline(outInfo);

</source>