No median filter in graph builder

I need to use median filter but also it is a part of bigger automatic procedure so I would like to create an XML in Graph builder. The problem is that median filter is possible to select in SNAP (Raster/Filtered Band/…-fig.1) but in the Graph Builder it is not on the list of filters possible to select. Is there any other way I can implement median filter to the XML ?

you can create it yourself as an user-created filter and save it
It will be placed inside .snap\auxdata\image_filters (automatically named user_filters.xml)
then access it in the graph builder

1 Like

thank you for the response, I’ve tried to do that but after creating and saving the filter, while I’m trying to select the filter it shows me that the format is incorrect. Do you know what might be the problem?

please try this one user-filters.xml (520 Bytes)

Thank you for the xml with filter. I have loaded it into graph but firstly the program gave me the message that filter is not selected and then after changing the tabs it gave me again the message about incorrect file format. I have tested that on SNAP 7.0 and 8.0

you are right, I also cannot use this user created filter.
I found this topic where an example of user filters is given: Where is Image Filter option in Raster menu?
However, this only works for linear filters, not for a median filter which cannot be expressed as a matrix.

1 Like

Media filter 3x3 working with GUI but not working using script in .xml file.
It is bug or feauter?

I think it is just not implemented in the Graph Builder.
Myabe @marpet can confirm.

1 Like

Yes, indeed this is true. Nonlinear filters are not implemented yet.

There are already two tickets regarding this issue in our bug tracker.

[SNAP-962] Create Filtered Band not working properly in Graph Builder
[SNAP-254] Align FilterOperator with Image Filters from GUI

The Python example code, I posted a while ago, might be helpful for you:

1 Like