[Paraview-developers] Replacement of SetInput with SetInputData (VTK5 vs. 6)

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon Apr 27 13:53:26 EDT 2015


> Now I am wondering: ifinside the RequestData method of a filter, do I *ever*
> need  to use SetInputConnection, and if yes, how?


Here's an example:

vtkMyFilter::RequestData(....)
{
   vtkDataSet* myinput = vtkDataSet::GetData(inputInformation[0], 0);

   vtkNew<vtkSomeFilter> filter1;
   filter1->SetInputData(myinput);

   vtkNew<vtkSomeFilter> filter2;
   filter2->SetInputConnection(filter1->GetOutputPort());
   ...

   filter2->Update()
}

Thus, for internal pipelines, it makes sense to use SetInputConnection.

> It seems like all filters
> I’ve had a look at always access the input data object (which I can only
> pass on using SetInputData, not SetInputConnection), not the input port.
> However, as a user with little VTK experience it seems like this might
> “break” the aforementioned pipeline?

It the example I gave, for example, if you use SetInputData() to pass
the output of filter1 to filter2, you'll need to call
filter1->Update() before doing that. Otherwise, filter1 has not
execute and hence doesn't have valid data to pass to filter2. Unlike
the old SetInput(), setting the dataset using SetInputData() doesn't
preserve the pipeline information i.e. filter2 will not update filter1
just because you called filter2->Update() if SetInputData() is used to
pass the data.

Hope that clarifies it a little.


More information about the Paraview-developers mailing list