More Pythonic VTK wrapping

While it may be nice to easily define pipelines, I wonder if >> or | really are pythonic in some way, so it still will be a “custom VTK stuff”. But I’m not a day to day python user, so I defer to them :slight_smile:

I have seen the use of custom operators. Examples: pyTorch, numpy etc added the @ operator for matrix multiplication (which took me a while to figure out!), Fenics uses the << operator to output vis data. I believe what is pythonic about it is using a shorthand to perform an operation. A common way of doing this is chaining operations like

source.filtera().filterb()

which is also not original to Python and is not feasible in our situation (one would have to add > 1000 methods for each filter).

Also I’m not sure of how execute() is different than the existing Update() ?

We can certainly extend Update() for this. The difference is that Update() does not return the output nor does it take any input. In the execute() method, I make a shallow copy of the output and return a smart pointer to it (to handle memory management).

output_data = aReader.execute()
# vs
aReader.Update()
output_data = aReader.GetOutput()

output_data = aFilter.execute(input_data)
#vs
aFilter.SetInputData(input_data)
aFilter.Update()
output_data = aFilter.GetOutput()