Creating custom filter in Python

Creating custom filters with Python alone via subclassing won’t work. The C++ virtual dispatch mechanism won’t consider your Python overridden methods. One way to create a customer filter in Python is to create it in C++ and then let VTK’s language wrapping tools provide Python bindings for you. But that’s a fair amount of work.

A better route is to use vtkPythonAlgorithm. You can find out more about them in blog posts vtkPythonAlgorithm is great and Developing HDF5 readers using vtkPythonAlgorithm. There are numerous examples in the VTK code base in the form of tests:

I hope that helps.

2 Likes