[vtkusers] pipelines connections

David E DeMarle dave.demarle at kitware.com
Wed Dec 2 11:53:58 EST 2009


You should use the new style. It actually connects the algorithms together.

The old style is still there for backward compatibility. In principle
it means connect the data produced by one algorithm to some other
algorithm. That should mean that if the first algorithm changes and
produces something new, then the second algorithm would never notice
it. In practice there is the following magic (in some but not all
algorithms of) vtk which converts the old style call to a new style
one and makes them equivalent.

//----------------------------------------------------------------------------
void vtkRectilinearGridAlgorithm::SetInput(vtkDataObject* input)
{
  this->SetInput(0, input);
}

//----------------------------------------------------------------------------
void vtkRectilinearGridAlgorithm::SetInput(int index, vtkDataObject* input)
{
  if(input)
    {
//HERE IS THE MAGIC
    this->SetInputConnection(index, input->GetProducerPort());
//HERE IS THE MAGIC
    }
  else
    {
    // Setting a NULL input removes the connection.
    this->SetInputConnection(index, 0);
    }
}

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



On Wed, Dec 2, 2009 at 11:26 AM, Lic. José M. Rodriguez Bacallao
<jmrbcu at gmail.com> wrote:
> Hi folks, I need to know which type of pipeline objects connections to
> use, the new style connections:
> object2.SetInputConnection(object1.GetOutputPort()) or the old style:
> object2.SetInput(object1.GetOutput()). This different connection types
> affect in performance or something, which are the advantages?
>
> PS: If possible, please, mail an example of the differences!!!
>
> --
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -----------------------------------------------------------------
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -----------------------------------------------------------------
> _______________________________________________
> 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