CS-SI/SIRIUS

Provide a small python tool to generate filter

Opened this issue · 11 comments

Provide a small python tool to generate filter

In case I'm not mistaken about the whereabouts of this issue, you'd may be interested in http://pybind11.readthedocs.io/en/master/

This is probably the most advanced solution to generate Python bindings from Modern C++11 & more code.

Thanks @LucHermitte for your feedback but it seems more related to #31
the idea here is to provide a tool which can generate filter used in sirius. This filter can be difficult to design.

The file https://github.com/CS-SI/SIRIUS/blob/master/doc/sphinx/source/code_py/simple_signal_proc.py should be a good start.
All we need is adding one dimension which is rather simple in most cases.
The Sirius doc should help a lot to check the filters behaviour.
Plus, I add here some examples to create 2D sinc, lanczos and some more.
We need python knowledge and of course understanding of what the filters should look like.

filters.zip

@dumasl , this code uses numpy and matplotlib. fft I guess is used through numpy?. I am confused about this issue and the other one #31. Are they same thing or different issues. Can someone help?

@rkanavath those really are different issues that I will try to explain here:

#31 is merely just about providing python API to what Sirius does which is resampling.

Now, Sirius uses filters for resampling purpose. Filters that have to be created somehow.
Since Sirius itself is not gifted with the ability to create filters (and shall not be), we need a tool to do that. For the sake of simplicity we decided it would be developed in Python, and, at least in the beginning of its on life cycle, will be delivered with Sirius.

Hence, trying to summarize all that, this current issue is about creating a tool that will help users shape rather simple filters. Then users could give such a filter to Sirius. For that they will launch it as an executable or using its C++ or Python API (the last one being the subject of #31).

Please tell me if I did not answer your question.

okay. IIUC you have to plug some python function into sirius processing. is that correct ?

Well not entirely. I guess I was not clear enough. Maybe it comes from the word "filter". Just to make it clear, here filter is not an OTB filter. Nothing like a function or a method. In Sirius context a filter is a collection of samples (weights) that one will apply to an image or a signal as part of a convolving process.

Now, metaphorically, say Sirius is a car that is really fast. Everyone can use it in a standard fashion which actually covers some of the functionality one could do with a car. But, if one wishes to take the most out of Sirius, it needs special gasoline (a special filter in our real context).
Now drivers won't find these mixed up gasoline on every road which is a shame because then they cannot exploit the maximum potential of Sirius. They could try to to make it on their own but it is a dangerous process not everyone masters.

So now we raise this issue which aims at filling this void by giving users who borrowed Sirius what they need to easily fashioned they own special gasoline.
It's not really a plug-in to Sirius. Not like a trailer or whatever. It's more like something that will stay inside your garage. It just provides you with something that Sirius can use, but actually some other cars could use as well. It is Sirius independent, and Sirius does not need it. It is just a nice tool to help you get the most out of Sirius.

I believe we could have given this "filters creator" his own repository and name.

I am quite unsure I made this clearer :)
Have I ?

okay. filter has many faces and currently there is a "filter" in sirius, one in OTB (don't know why this come up in discussion) and another in image processing terms. I understand your reference to filter is some function (mathematical) applied to an image. so in a way you are applying a filter ( written in form of a function perhaps) to a sirius process. I will have to revisit this once I settle on python bindings.

Draft here

python python/filters.py -h

@dumasl I may need your help to improve the CLI and to check the generators

@tfeuvrier-cs this tool must be external. It takes some parameters (which describe the filter) as input and generate a file with the filter inside. This file is provided to sirius as input.

@savmickael : this issue could be close. ; this tool is available from gen-sirius-filter project (https://gitlab.cloud-espace.si.c-s.fr/msavinau/gen-sirius-filter)