VTK/VTK 6 Migration/Removal of Update

From KitwarePublic
< VTK
Revision as of 18:54, 6 April 2012 by Berk (talk | contribs) (Created page with "= Removal of Pipeline Update Methods from vtkDataObject = VTK 6 introduces a number of backwards-incompatible changes. The reasons behind these changes are described in more det...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Removal of Pipeline Update Methods 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. Here we discuss the following update methods and provide suggestions in updating existing code.

Update()

vtkDataObject::Update() was a convenience method that in turn called Update() on the algorithm that produced the given data object. Since the data object no longer has a reference to its producer, this function could not be maintained and was removed.

Example 1

<source lang="cpp"> vtkDataObject* dobj = someAlgorithm->GetOutput(); dobj->Update(); </source>

should become

<source lang="cpp"> someAlgorithm->Update(); </source>

Example 2

Replace:

<source lang="cpp"> vtkDataObject* dobj = aFilter->GetOutput(1); dobj->Update(); </source>

with:

<source lang="cpp"> aFilter->Update(1); </source>

UpdateInformation()

vtkDataObject::UpdateInformation() was a convenience method that in turn called UpdateInformation() on the algorithm that produced the given data object. Since the data object no longer has a reference to its producer, this function could not be maintained and was removed.

Example 1

Replace

<source lang="cpp"> vtkDataObject* dobj = aFilter->GetOutput(); dobj->UpdateInformation(); dobj->SetUpdateExtent(0 /*piece*/, 2 /*number of pieces*/); dobj->Update(); </source>

with

<source lang="cpp"> aFilter->UpdateInformation(); vtkStreamingDemandDrivenPipeline::SetUpdateExtent(

       aFilter->GetOutputInformation(0 /*port number*/),
       0 /*piece*/,
       2 /*number of pieces*/,
       0 /*number of ghost levels*/);

aFilter->Update(); </source>

PropagateUpdateExtent()

vtkDataObject::UpdateInformation() was a convenience method that in turn called UpdateInformation() on the executive of the algorithm that produced the given data object. Since the data object no longer has a reference to its producer, this function could not be maintained and was removed.

Example 1

Replace

<source lang="cpp"> vtkDataObject* dobj = aFilter->GetOutput(); dobj->UpdateInformation(); dobj->SetUpdateExtent(0 /*piece*/, 2 /*number of pieces*/); dobj->PropagateUpdateExtent(); </source>

with

<source lang="cpp"> aFilter->UpdateInformation(); aFilter->SetUpdateExtent(0 /*piece*/, 2 /*number of pieces*/, 0 /*ghost levels*/); aFilter->PropagateUpdateExtent (); </source>

TriggerAsynchronousUpdate()

This method was no longer being used and therefore was removed from VTK as of VTK 6.

UpdateData()

vtkDataObject::Update() was a convenience method that in turn called UpdateData() on the executive of the algorithm that produced the given data object. Since the data object no longer has a reference to its producer, this function could not be maintained and was removed.

Example 1

Replace

<source lang="cpp"> vtkDataObject* dobj = aFilter->GetOutput(); dobj->UpdateInformation(); dobj->SetUpdateExtent(0 /*piece*/, 2 /*number of pieces*/); dobj->PropagateUpdateExtent(); dobj->UpdateData(); </source> with

<source lang="cpp"> aFilter->UpdateInformation(); vtkStreamingDemandDrivenPipeline::SetUpdateExtent(

       aFilter->GetOutputInformation(0 /*port number*/),
       0 /*piece*/,
       2 /*number of pieces*/,
       0 /*number of ghost levels*/);

aFilter->Update(); </source>