More Pythonic VTK wrapping

It’s too bad that you can’t do source.filtera().filter() , as that feels the most natural and similar to other “chaining” Python APIs.

Not feasible with > 1000 algorithms :slight_smile: Also, chaining is not as old as people might think. numpy doesn’t let you chain ufuncs for example (while PyTorch lets you chain functions).

While I love the idea of a function that calls .Update() and then returns the output (.GetOutput() ), the word “execute” doesn’t convey that concept to me. It sounds like the filter is being run, but there’s no connotation of anything being returned by an “execute” method. What about .generate() ? Or maybe .get_result() ?

I hear you. I like generate(). Another option would be to use the __call__() method. That would look like vtkContourFilter(input=foo, contour=[10, 20])(). We could also go a more functional route, like:

result = apply(vtkContour(contours=[10, 20]) >> vtkShrink(), input_data)

For full pipelines, this could look like

result = apply(vtkSomeReader(file_name="...") >> vtkContour(contours=[10, 20]) >> vtkShrink())