How to write an Image-Filter output in a gpt graph?


#1

Hello STEP forum community. Thanks in advance for opening, reading or commenting on this.

I’m using SNAP in Ubuntu 18.04 LTS and I need to process some crazy amount of Sentinel-2 imagery. I have managed to work with gpt to concatenate some nodes but I’m having problems with the operator Image-Filter. Basically, I want to obtain a mask an then apply an erosion kernel. The mask I can get from a BandMaths node called “pixmask” and then:

   <node id="Erode">
    <operator>Image-Filter</operator>
      <sources>
        <sourceProduct refid="pixmask"/>
      </sources>
      <parameters>
		  <sourceBands>pixagua</sourceBands>
		  <selectedFilterName>Erosion</selectedFilterName>
      </parameters>
  </node>

For the moment, this is the last node in the graph and it does not write the output eroded mask. I know there is a Write operator (an operator I don’t quite handle), but if I am trying to continue with this graph, how can I refer to the resultant eroded mask in the next node? The operator help does not mention any output option or surely I am missing something:

  <graph id="someGraphId">
    <version>1.0</version>
    <node id="someNodeId">
      <operator>Image-Filter</operator>
      <sources>
        <sourceProduct>${sourceProduct}</sourceProduct>
      </sources>
      <parameters>
        <sourceBands>string,string,string,...</sourceBands>
        <selectedFilterName>string</selectedFilterName>
        <userDefinedKernelFile>file</userDefinedKernelFile>
      </parameters>
    </node>
  </graph>

My questions (TL;DR):

  1. How can I write a filtered band using gpt?
  2. How can I refer to the output of an Image-Filter operator in the next node in a graph?

#2

I am bumping this since still trying to figure out how to write into a file one morphological filter band from a binary BandMaths output. In SNAP Desktop, after creating the binary raster using Band Maths I can use a morphological filter from right-click menu to apply a snap predefined filter called Erosion 3x3 but I can’t figure out what parameters to use with my Filter-Image (I am not sure if this is the right one) operator in a graph to produce the same result as in SNAP Desktop.

I’m starting to feel a bit ashamed for asking for something that maybe could be easily solvable by reading thoroughly the man pages, please consider English is not my mother tongue and I have done my best googling around.


#3

Hi, I ve been facing exactly the same issues. In gpt I cannot output the filter band (in my case the standard deviation 3x3. This is how my image-filter node looks like

<node id="Filter">
  <operator>Image-Filter</operator>
  <sources>
    <sourceProduct refid="RayleighCorrection"/>
  </sources>
  <parameters>
    <sourceBands>rtoa_B8</sourceBands>
    <selectedFilterName>Standard Deviation 3x3</selectedFilterName>
    <userDefinedKernelFile/>
  </parameters>

Any help is much appreciated

Cheers
Lazaros


#4

I think I found why its not working :stuck_out_tongue:


#5

So, we are back to square one here or did you manage to make it work? I understand they could achieve their intended results circumventing the direct use of non-linear or morphological filters by enabling a user-defined filter. Did you try this? I’m gonna try today but I’m not a software developer, so if it works it may take a while for me. Anyway, if I get to something I’ll be back. Thanks for attending this thread.