# How to run deconvolution filters available at “itk Simple Filters” module from the command line in linux?

**URL:** <https://discourse.slicer.org/t/how-to-run-deconvolution-filters-available-at-itk-simple-filters-module-from-the-command-line-in-linux/5523>\
**Category:** Support\
**Created:** [January 26, 2019, 1:40pm UTC](https://discourse.slicer.org/t/how-to-run-deconvolution-filters-available-at-itk-simple-filters-module-from-the-command-line-in-linux/5523 "2019-01-26T13:40:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [January 26, 2019, 1:40pm UTC](https://discourse.slicer.org/t/how-to-run-deconvolution-filters-available-at-itk-simple-filters-module-from-the-command-line-in-linux/5523/1 "2019-01-26T13:40:34Z")

</div>

Hello Dear Developers and Users

How can I run deconvolution filters available at “ **itk Simple Filters** ” module (such as _RichardsonLucyDeconvolutionImageFilter_ and _TikhonovDeconvolutionImageFilter_) from the command line of linux?

Please guide me,  
Shahrokh.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 26, 2019, 6:52pm UTC](https://discourse.slicer.org/t/how-to-run-deconvolution-filters-available-at-itk-simple-filters-module-from-the-command-line-in-linux/5523/2 "2019-01-26T18:52:50Z")

</div>

You can run the code the same way as within Slicer. You can either provide the entire code that you would like to run on the command line (good for a short, simple cases, see examples [here](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Launching_Slicer)) or put the code in a .py file and execute that with Slicer as shown [here](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#How_can_I_run_slicer_operations_from_a_batch_script.3F).

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [January 28, 2019, 1:46pm UTC](https://discourse.slicer.org/t/how-to-run-deconvolution-filters-available-at-itk-simple-filters-module-from-the-command-line-in-linux/5523/3 "2019-01-28T13:46:51Z")

</div>

Dear Andras

Thanks a lot for your guidance. As mentioned you, I want to use your second method (put the code in a .py file and execute that with Slicer).

Where can I find the Python codes for these filters?

Please guide me,

Shahrokh.

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [January 29, 2019, 12:11pm UTC](https://discourse.slicer.org/t/how-to-run-deconvolution-filters-available-at-itk-simple-filters-module-from-the-command-line-in-linux/5523/4 "2019-01-29T12:11:36Z")

</div>

Dear Andras

I solved my problem in another way. For example, I edit the file of _itkTikhonovDeconvolutionImageFilterTest.cxx_ (in the path of _~/ITK/Modules/Filtering/Deconvolution/test_) as following:

**From:**  
int itkTikhonovDeconvolutionImageFilterTest(int argc, char \* argv[])\*\*

**To:**  
int main(int argc, char \* argv[])\*\*

and create the file of _CmakeLists.txt_ Which includes the following lines:

project(itkTikhonovDeconvolutionImageFilterTest)  
find\_package(ITK REQUIRED)  
include({ITK\_USE\_FILE}) add\_executable(itkTikhonovDeconvolutionImageFilterTest itkTikhonovDeconvolutionImageFilterTest.cxx) target\_link\_libraries(itkTikhonovDeconvolutionImageFilterTest {ITK\_LIBRARIES})

and finally compile it with the commands of cmake and make. With doing it, at now I have a executable file with the name of itkTikhonovDeconvolutionImageFilterTest

I think that this is not the correct way and logical method.  
According to Andras’s guidance, where can I find the Python codes for these filters?

Please guide me.  
Shahrokh

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [January 29, 2019, 2:17pm UTC](https://discourse.slicer.org/t/how-to-run-deconvolution-filters-available-at-itk-simple-filters-module-from-the-command-line-in-linux/5523/5 "2019-01-29T14:17:02Z")

</div>

The following page has some python examples of using SimpleITK filters.  
[http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python\_html/300\_Segmentation\_Overview.html](http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/300_Segmentation_Overview.html)

In general, it is usually in a workflow like:

```python
otsu_filter = sitk.OtsuThresholdImageFilter()
otsu_filter.SetInsideValue(0)
otsu_filter.SetOutsideValue(1)
seg = otsu_filter.Execute(img_T1)

```

You can review the [TikhonovDeconvolutionImageFilter.json](https://github.com/SimpleITK/SimpleITK/blob/f086d11979d4dd2fd772d9e947fe7cce8c6a91a6/Code/BasicFilters/json/TikhonovDeconvolutionImageFilter.json) which details the available members. You could also use the filter in Slicer using the Simple Filters module. It will usually print to the python console the parameters that were set to execute and you could use that as an example.
