Transform - Tiles: Sieve

The Sieve template appears in the template list when a raster tile field, of type Tile, has been picked in the Transform pane.  The template performs a sieve operation on an image channel, running  until there are no more areas to merge.   In English, sieve is pronounced "siv", to rhyme with "give".



The word sieve means a mesh or grid that is used to separate coarser pieces of material from finer bits.   If we want to separate a mixture of larger rocks from smaller pebbles, we can sift the material using a sieve of desired mesh size. The smaller pebbles fall through the mesh, leaving the larger rocks.   


In GIS, a sieve lets the smaller regions of like-valued pixels "fall through" the algorithm, with the larger regions of pixels filling their pixel values into where the smaller regions used to be.  Unlike the physical sifting of rocks and pebbles that simply gets rid of smaller pebbles, a sieve in GIS is also a filling in of smaller regions with pixel values from neighboring bigger regions.




A sieve operation creates a new raster image from a source image.   The operation analyzes pixel values in the source image to find regions of like-valued pixels.  It then builds a result raster where smaller regions of like-valued pixels, those below the size threshold specified, are merged into larger neighboring regions.  The result is like removing the "noise" of smaller pixel regions and leaving only the "bigger picture" regions.



Launch the template by choosing a tile field and then double-clicking the Sieve template.



When the template launches we can specify options:


  • Channel - The channel of the image to use, using zero-based numbering where the first channel is 0.  


  • Similarity - A number specifying how similar pixel values must be for pixels to be considered part of the same region. Setting this to 1 tells the system that pixels with values of 1.1, 1.2 and 1.7 are similar enough to each other and should be put into the same area if they are neighbors, but a pixel with the value of 2.0 should be put into a different area.  This parameter is called the quantization level argument in the TileSieve SQL function which powers this transform.


  • Minimum area - The minimum size of a region, in pixels, for the region not to be merged into larger neighboring regions.  Regions of pixels consisting of a smaller number of pixels will be merged into larger neighboring regions, if possible. Regions consisting of a number of pixels equal to or larger than this value will annex any smaller neighbors that are smaller than the given threshold.


  • Merge neighbor - The method used to determine which neighbor to merge into when there are multiple candidates: biggest area merges the smaller region into the neighbor with the biggest area, or biggest common boundary merges into the neighbor with the biggest boundary in common.


  • Result - The usual transform choice between putting the result into the same field, into a different field, into a new field in that same table, or into an entirely new table.




Consider a raster image that shows land use and land cover (LULC) data as pixel values, an image similar to that used in the Example: Trace Vector Areas from Raster Pixels example.



The image above has a single channel.  



 With the focus on the LULC Raster image, in the Transform pane we choose the Tile field and then the Sieve template.




In the Sieve template, we choose channel 0 for the Channel and we use the default 1 for Similarity.  We use the default 100 as the Minimum area, meaning we intend to end up with regions of pixels that all are at least 100 pixels in size.  


For the Result destination, we choose New Table, so the result will be used to create a new image and new table.  For the Channel type we choose int32 and then enter LULC 100 as the name of the new image.     The default table name created automatically as we enter a name for the New image ends in ...Table.  This topic uses a table name that ends in ...Tiles, which is how some users prefer to name tables for images.  Others prefer to have all of their tables, both for drawings and images, end in ...Table.  We can adjust the name automatically created for the table however we like.


We could use whatever names we want for the name of the new image, but it is wise to use names that remind us of what they are supposed to be.


If we would like to see a preview, we can press the Preview button.



The preview shows how all regions of like-valued pixels that are smaller than 100 pixels in size will be merged into larger, neighboring regions, all of which are larger than 100 pixels in size.  


If we like, we can change the Minimum area threshold to 1000 and then press Preview to see what that would do.



Using a higher threshold will eliminate all smaller regions that are less than 1000 pixels in size.  


Based on the previews we see, we change the Minimum area threshold back to 100 pixels.  


Press Transform.  


A new image called LULC 100 appears in the Project pane.   We drag and drop the new LULC 100  image into the LULC Raster window as a layer.    



The image has yet to be styled.  In the Properties dialog for the LULC raster image we copy the StylePixel property value .  In the Properties dialog for the LULC 100 image we add a StylePixel property and then we paste the copied value from the LULC raster image.  That is simply a way of copying the same style from one image to another, so that all the pixels with like values are colored the same in both images.



We can compare the new image, above, to the original image, below.



Both images have exactly the same number of pixels.   The pixel values in the new image have been adjusted so that values for pixels in the old image that formed regions of fewer than 100 images have been altered to be the same as the pixel values in neighboring regions that had more pixels, above the threshold of 100 pixels per region.   The result is that very small regions of like valued pixels have been merged into larger regions of like valued pixels.


See Also

Transform Pane


Transform Reference


Transform - Tiles


Example: Trace Vector Areas from Raster Pixels