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

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.

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) or put the code in a .py file and execute that with Slicer as shown here.

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.

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

The following page has some python examples of using SimpleITK filters.
http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/300_Segmentation_Overview.html

In general, it is usually in a workflow like:

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

You can review the 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.