Combine Programmable sources/filters into one

Hi PV community,

Is it possible to combine the following procedure into one “programmable filter”?:

  1. create a “programmable source”, say, a vtkStructuredGrid
  2. select the “resample with dataset” filter to sample my data onto the source created in 1)
  3. apply a “programmable filter” on the resampled data to further process it and add the processed result into the output of this “programmable filter”

To combine them, I can think of creating a “programmable filter”, and in the script of this programmable filter,

a) create a grid like in 1), and then
b) apply a vtkResampleWithDataSet filter on the grid and my input data,
c) process the resampled “intermediate” data
d) append the processed data to output

The obstacle for me here is how to use the vtkResampleWithDataset filter, like how to set the input grid and data to be resampled, and how to get hold of the resampled data.

Any suggestion is appreciated.

This sounds like a job for a custom filter, available under Tools -> Create Custom Filter. It lets you chain several filters together and expose a subset of properties from all of them in a new, custom filter.

1 Like

Yes, this solved my problem! Thank you, Cory.

Now, if I would like to specify certain parameters that I hard coded in my old “programmable filter/source” section, when I apply my new custom filter, I need to use the VTKPythonAlgorithmBase-based approach as specified in the section 12.4 Python Algorithm, is this correct?

That is probably the simplest approach, yes.

1 Like