# Combine two filters into one in Custom Application

**URL:** https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975
**Category:** Development
**Created:** [April 27, 2023, 5:21pm UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975 "2023-04-27T17:21:11Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [April 27, 2023, 5:21pm UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/1 "2023-04-27T17:21:11Z")

</div>

Hi,

I want to combine two filters (calculator and glyph to be specific) into one filter in my custom application. How can I achieve that?

P.S I don’t want to create a custom filter in the GUI, but want to create a filter when the application is built it should be there

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [April 27, 2023, 9:22pm UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/2 "2023-04-27T21:22:38Z")

</div>

I think some of the examples have custom filters in the repository. `ElevationFilter` maybe?

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [April 28, 2023, 3:51am UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/3 "2023-04-28T03:51:41Z")

</div>

I am sorry if my original question was not clear.  
I don’t want to create a new filter but combine two filters which are already in Paraview (glyph and calculator).

ElevationFilter does not combine two filter but only inherits from one existing filter (vtkElevationFilter).

I could not find an example of a filter which is a combination of two filters or inherits two filters.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [April 28, 2023, 4:12am UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/4 "2023-04-28T04:12:13Z")

</div>

VTK doesn’t do multiple inheritance anyways. You’ll need to make a new filter of the appropriate type and drive the other filters internally (basically, “composition over inheritance”). ParaView has a few that do this, but I can’t remember exactly. Maybe one of the image reader meta filters?

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [April 29, 2023, 2:10am UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/7 "2023-04-29T02:10:20Z")

</div>

Yeah I get that, and I was also thinking of doing composition instead of inheritance.

I was not able to find an example in paraview filters that uses composition would you be able to tell me the name?

And how do you decide from which vtk filter should we inherit, for example for calculator and glyph should I choose `vtkPassInputTypeAlgorithm` or `vtkPolyDataAlgorithm`?

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [April 29, 2023, 2:24am UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/8 "2023-04-29T02:24:25Z")

</div>

And I am unable to include vtkPVArrayCalculator.h or vtkPVGlyphFilter.h in my code, even though I am able to include other vtk files. Do I need to add something to vtk.module file?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [May 1, 2023, 2:24pm UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/9 "2023-05-01T14:24:57Z")

</div>

They seem to live in the `ParaView::VTKExtensionsFiltersGeneral` module.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 2, 2023, 3:59am UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/10 "2023-05-02T03:59:16Z")

</div>

Yes I am using vtkPVArrayCalculator and vtkPVGlyphFilter from there. But was not able to find an example of filter which uses composition to combine two filters.

Is there any other way to combine two filters? Maybe somehow use the XML file generated from the custom filter in Paraview’s GUI?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [May 2, 2023, 12:35pm UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/11 "2023-05-02T12:35:47Z")

</div>

I think you’re now in @mwestphal or @cory.quammen territory now. I’m mainly the build/process guy and only have a very basic coverage of actually using ParaView.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 2, 2023, 4:51pm UTC](https://discourse.paraview.org/t/combine-two-filters-into-one-in-custom-application/11975/12 "2023-05-02T16:51:09Z")

</div>

Ah I see, but would you be able to pinpoint to an example which uses composition to combine two or more filters into one?
