VTK/VTK 6 Migration/Removal of Update

From KitwarePublic
< VTK
Revision as of 14: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

vtkDataObject* dobj = someAlgorithm->GetOutput();
dobj->Update();

should become

someAlgorithm->Update();

Example 2

Replace:

vtkDataObject* dobj = aFilter->GetOutput(1);
dobj->Update();

with:

aFilter->Update(1);

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

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

with

aFilter->UpdateInformation();
vtkStreamingDemandDrivenPipeline::SetUpdateExtent(
        aFilter->GetOutputInformation(0 /*port number*/),
        0 /*piece*/,
        2 /*number of pieces*/,
        0 /*number of ghost levels*/);
aFilter->Update();

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

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

with

aFilter->UpdateInformation();
aFilter->SetUpdateExtent(0 /*piece*/, 2 /*number of pieces*/, 0 /*ghost levels*/);
aFilter->PropagateUpdateExtent ();

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

vtkDataObject* dobj = aFilter->GetOutput();
dobj->UpdateInformation();
dobj->SetUpdateExtent(0 /*piece*/,  2 /*number of pieces*/);
dobj->PropagateUpdateExtent();
dobj->UpdateData();

with

aFilter->UpdateInformation();
vtkStreamingDemandDrivenPipeline::SetUpdateExtent(
        aFilter->GetOutputInformation(0 /*port number*/),
        0 /*piece*/,
        2 /*number of pieces*/,
        0 /*number of ghost levels*/);
aFilter->Update();