# Combine Programmable sources/filters into one

**URL:** https://discourse.paraview.org/t/combine-programmable-sources-filters-into-one/4682
**Category:** ParaView Support
**Tags:** vtk, python
**Created:** [June 25, 2020, 4:43pm UTC](https://discourse.paraview.org/t/combine-programmable-sources-filters-into-one/4682 "2020-06-25T16:43:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![liangwang0734](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/3ab097/32.png) [@liangwang0734](https://discourse.paraview.org/u/liangwang0734)
#### Post date: [June 25, 2020, 4:43pm UTC](https://discourse.paraview.org/t/combine-programmable-sources-filters-into-one/4682/1 "2020-06-25T16:43:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [June 25, 2020, 5:19pm UTC](https://discourse.paraview.org/t/combine-programmable-sources-filters-into-one/4682/2 "2020-06-25T17:19:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![liangwang0734](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/3ab097/32.png) [@liangwang0734](https://discourse.paraview.org/u/liangwang0734)
#### Post date: [June 25, 2020, 8:06pm UTC](https://discourse.paraview.org/t/combine-programmable-sources-filters-into-one/4682/3 "2020-06-25T20:06:21Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [June 25, 2020, 8:09pm UTC](https://discourse.paraview.org/t/combine-programmable-sources-filters-into-one/4682/4 "2020-06-25T20:09:37Z")

</div>

That is probably the simplest approach, yes.
