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.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityWhere 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.