Where can i use a sieve filter for my supervised classification?

Can i do it in Erdas Imagine or in ArcGIS?

I can't find it anywhere.


The sieve model is fairly straight forward and you can implement it in ArcGIS using "RegionGroup", "ExtractByAttributes", "SetNull" and "Nibble". It is good to understand how these methods actually work so, I encourage you to work through this method yourself. I do have a sieve function available in the Geomorphometry & Gradient Metrics Toolbox.

You can run the following commands in the Spatial Analyst > Raster Algebra > Raster Calculator

First apply RegionGroup to group cells

tmp1 = RegionGroup("YourRaster", "EIGHT", "WITHIN", "ADD_LINK")

Using the grouped cells you can then query the attribute table to subset values >= MMU

tmp2 = ExtractByAttributes("tmp1", 'Count >= 4')

For input to Nibble you need to set the 0 value in tmp2 to NoData

tmp3 = SetNull("tmp2" == 0, "tmp2")

You then nibble values, in your original raster, that are NoData in tmp3

outraster = Nibble("YourRaster", "tmp3")

In this example the value "4", in the ExtractByAttributes function, represents the MMU. The raster assignment (i.e., "tmp =") is only in the example for reference and will not work in the syntax. You must define output raster in the GUI.


Using Erdas, the Sieve tool is located:

Raster tab > Thematic (Raster GIS group) > Sieve

Also, a widely accepted approach is to use GDAL's gdal_sieve.py, describes as follows:

The gdal_sieve.py script removes raster polygons smaller than a provided threshold size (in pixels) and replaces replaces them with the pixel value of the largest neighbour polygon. The result can be written back to the existing raster band, or copied into a new file.

enter image description here

  • Since you cannot define a MMU, Focalmajority does not work the same a sieve. Also, if there is a tie NoData is the result. – Jeffrey Evans Apr 1 '14 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.