[vtkusers] Traversing (browsing) VTK pipeline

David E DeMarle dave.demarle at kitware.com
Mon Aug 30 19:04:06 EDT 2010


Here is some code I wrote long ago that runs up the pipeline to find
out who the progenitor was.

void vtkStreamingUpdateSuppressor::PrintPipe(vtkAlgorithm *alg)
{
  //for debugging, this helps me understand which US is which in the messages
  vtkAlgorithm *algptr = alg;
  if (!algptr) return;
  if (algptr->GetNumberOfInputPorts() &&
      algptr->GetNumberOfInputConnections(0))
    {
    vtkAlgorithmOutput *ao = algptr->GetInputConnection(0,0);
    if (ao)
      {
      algptr = ao->GetProducer();
      this->PrintPipe(algptr);
      }
    cerr << "->";
    }
  cerr << alg->GetClassName();
}

Note it only traces up the primary input so it doesn't handle merging,
and of course it is traversing only upward, so it doesn't handle
branching either.

I've always meant to, but have not yet, put together a more complete
pipeline examiner. The API you need to do that should be found almost
exclusively in vtkExecutive and vtkAlgorithm.

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



2010/8/27 Андрей Траченко <goodrone at gmail.com>:
> Another question of the same nature:
>
> given a vtkAlgorithm, can I tell what other algorithms are connected
> to it? I suspect I should use something like vtkExecutive, but I can't
> fugure out how.
>
> 2010/8/27 Андрей Траченко <goodrone at gmail.com>:
>> Hello,
>>
>> I'd like to browse a given VTK pipeline, where filters are connected
>> with a->SetInputConnection(b->GetOutputPort()), i.e. get a pointer to
>> every filter in the pipeline. Is it possible to do? Where do I start?
>> Can I browse it starting with a vtkRenderer?
>>
>> Thank you!
>> Andrew
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list