[vtkusers] multiple outputs

Lazzarato Dr. Gianni lazzadrgi at libero.it
Mon Jul 31 16:42:19 EDT 2006


Hi vtkusers,

 

                 is it possibile to make a filter with 2 different type data
outputs ports ( 1 imagedata and 1 polydata)?

 

 

I  have a filter inherited from vtkImageAlgorithm 

 

 

In the constructor:

 

  this->SetNumberOfOutputPorts(2);

 

  vtkPolyData *output2 = vtkPolyData::New();

  this->GetExecutive()->SetOutputData(1, output2);

  output2->Delete();

 

 

I overload FillOutputPortInformation default metod as follow:

 

//--------------------------------------------------------------------------
--

int vtkMYfilter::FillOutputPortInformation(int port, vtkInformation *info)

 

//imposto il tipo dato in Output sulle porte uscita p.s notare che la
sintassi per la

// definizione del tipo dato è diversa da FillInputPortInformation

{

  if (port == 0)

            {

            info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkImageData");

            return 1;

            }

  else if (port == 1)

            {

            info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkPolyData");

            return 1;

            }

  return 0;

 

}

 

And using the metod:

 

//--------------------------------------------------------------------------
--

vtkPolyData * vtkMYfilter::GetMyPolyData()

 

  {

  if (this->GetNumberOfOutputPorts() < 2)

    {

    return NULL;

    }

            // ritorna il polydata probe in porta 1

            return vtkPolyData::SafeDownCast(

    this->GetExecutive()->GetOutputData(1));

 }

//--------------------------------------------------------------------------
--

 

I try to use this added port using: 

 

        vtkPolyData* pd = vtkPolyData::New();

 

                        pd = vtkMYfilterinstance->GetOutput(1);  

 

I expect to obtain a polydata from ->GetOutput(1);  but I obtain a compiler
type check error


 

What is wrong?

I searched for a vtk class example with 2 different output type data to
follow, but I did not discover any..

Thank you all in advance for all your suggestions

 

Gianni

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060731/57623a9d/attachment.htm>


More information about the vtkusers mailing list