Thanks alot Ken,

When you highlight multiple datasets for input into a
filter, is that multiple ports or multiple connections on one port ?







On Wed, 6 May 2009, Moreland, Kenneth wrote:

There are two parts to making this work.  The first part is supporting multiple 
ports and/or connections in the filter itself.  To set the number of input ports, 
you call this->SetNumberOfInputPorts() in the filter's constructor.  To set the 
number of connections allowed on each port, you override the 
FillInputPortInformation method and add the appropriate flags to the information 
object.  The specifics are documented at the beginning of Chapter 13 (How to Write 
an Algorithm for VTK) in the latest VTK User's Guide book.

The second part is to announce the input ports and/or connections in the server manager 
XML.  To set multiple ports, provide multiple InputProperty elements, one for each input. 
 These are easiest to set up if you provide convenience methods for each port in your 
filter that call SetInputConnection with the appropriate port number.  The arguments for 
the InputProperty tag provide information about ports that support multiple connections 
and optional ports.  The ParaView Guide book provides some documentation on the XML 
structure and the ParaView3/Servers/ServerManager/Resources/filters.xml source file 
provides plenty of examples.  The ArbitrarySourceStreamTracer, labeled "Stream 
Tracer (Custom Source)", provides good examples of both multiple ports and ports 
that support multiple connections.

-Ken


On 5/5/09 5:08 PM, "David Fuentes" <[email protected]> wrote:

Hello,


What is the proper way to write a filter plugin for paraview w/ multiple
connections and access the data from each connection?


I have been trying to use the vtkProgrammableFilter,
vtkPythonProgrammableFilter, vtkMultiBlockDataGroupFilter, and
vtkTemporalStaticsFilter as examples.


int vtkMyFilterPlugin::RequestData(
  vtkInformation *vtkNotUsed(request),
  vtkInformationVector **inputVector,
  vtkInformationVector *outputVector)
{

  int numInputs = inputVector[0]->GetNumberOfInformationObjects();
  for (int idx = 0; idx < numInputs; ++idx)
    {
     vtkInformation *inInfo = inputVector[0]->GetInformationObject(idx);

     vtkDataObject *input = vtkDataObject::GetData(inInfo);

     vtkDataSet *inputDataSet  = vtkDataSet::SafeDownCast( input) ;

     .
     .
     .
}

where numInputs = the number of connections to my Filter.
vtkDataSet::SafeDownCast(input) returns a NULL pointer when I have
multiple connections to the filter but works for ONE connection.
How do I get the pointer(s) that will let me access the vtkDataArray
for each connection to my filter? ie

     vtkPointData *pd=inputDataSet->GetPointData();
     int numArrays = pd->GetNumberOfArrays();
     for (int i = 0; i < numArrays; i++)
       {
         vtkDataArray *array = pd->GetArray(i);
       }


thanks,
df
_______________________________________________
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview




  ****      Kenneth Moreland
   ***      Sandia National Laboratories
***********
*** *** ***  email: [email protected]
**  ***  **  phone: (505) 844-8919
   ***      web:   http://www.cs.unm.edu/~kmorel


_______________________________________________
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to