# Python filter example

**URL:** https://discourse.itk.org/t/python-filter-example/1853
**Category:** Beginner Questions
**Tags:** python, filter, example
**Created:** [May 9, 2019, 12:53pm UTC](https://discourse.itk.org/t/python-filter-example/1853 "2019-05-09T12:53:19Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![fbudin](https://discourse.itk.org/user_avatar/discourse.itk.org/fbudin/32/14_2.png) [@fbudin](https://discourse.itk.org/u/fbudin)
#### Post date: [May 9, 2019, 3:44pm UTC](https://discourse.itk.org/t/python-filter-example/1853/4 "2019-05-09T15:44:15Z")

</div>

Hello @finetjul,

Are you trying to compose existing ITK filters or use some filters and add custom steps at some point in the processing? If you are simply trying to compose filters together, I suggest you take a look at the ITK Python `pipeline` class for which I wrote an example [here](https://discourse.itk.org/t/reference-count-with-python/1483/8). Note that you may already have tried that since I wrote this example as an reply to one of your questions.  
If you need to add custom steps in your processing, you could try to still use this class but combine it with an [ITK Python `templated_class` object](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Wrapping/Generators/Python/itkExtras.py#L713).  
If you are looking at actually fully writing a filter from scratch in Python, I cannot think of a good example right now, but if I think of one, I will add it here.

---

_[View the full topic](https://discourse.itk.org/t/python-filter-example/1853)._
