VtkPythonAlgorithm with adaptable outputType

I would like to develop a filter that could works with either vtkUnstructuredGrid or vtkPolyData objects:

  • if the input object is a vtkUnstructuredGrid, it should return a vtkUnstructuredGrid object
  • if the input object is a vtkPolyData, it should return a vtkPolyData object

Is it possible to define such filter with a vtkPythonAlgorythm subclass?

Have you got any example showing how to setup the vtkPythonAlgorithm outputType on the fly, according to input data information?

Best Regards,