Smoothing zone edges with Boundary Clean

Available with Image Server

The Boundary Clean function is used to generalize along the edges of zones in a raster. The edges are smoothed by expanding and shrinking boundaries between the zones.

Generalize the edges

The Boundary Clean function generalizes, or simplifies, rasters by smoothing the boundaries between zones. It applies an expand and shrink method to evaluate each cell using its immediate neighbors. Several options for controlling how the cells of the zones influence the smoothing are available. The degree of smoothing can also be controlled.

Sort by priority

The process begins by sorting the zones in the input raster by a particular priority. For each cell in the input, the priority is used to determine which zone value from the surrounding neighborhood can replace the value of the processing cell.

The sorting priority can be based on the values of the zones or the size of the zones. The Sort type parameter specifies the sorting priority to use. With the default Do not sort setting, cells from zones with larger values will have a higher priority to expand into zones with smaller values. With the Descending setting, zones that are larger in area will have the priority to expand into zones with smaller areas. With the Ascending setting, zones with smaller areas will have the priority to expand into zones with larger areas.

Amount of smoothing

The amount of smoothing is controlled by the number of times the expand and shrink process is performed: once or twice. The default is twice, which results in a greater amount of smoothing.

Expand and shrink process

The expand and shrink process evaluates the immediate neighbors of each processing cell according to the sorting priority type set in the Sort type parameter.

In the process, an expansion is followed by shrinking. This process will occur one time if the Run expansion and shrinking twice parameter is unchecked. If the parameter is checked, the expand and shrink process will be performed twice.

Additional details for the algorithms used in the process are below.

One-way expand and shrink

With the one-way setting, the expand and shrink process is performed once.

In the expand pass, the following occur:

  • For each processing cell in the input raster, evaluate each neighbor cell.
  • For each neighbor cell, assess whether the priority value of that neighbor cell is less than the priority value of the processing cell. If it is, assign the internal neighbor priority to be that of the input processing cell. Update the internal expanded raster with the new priority value, and proceed to the next neighbor cell.

In the shrink pass, the following occur:

  • For each processing cell in the input raster, evaluate each neighbor cell using the value of the internal expanded raster that is created in the first pass.
  • If the priority of a neighbor cell is equal to the priority of the processing cell, copy the cell value from the original input raster to the output. If the condition is not satisfied for any of the neighbor cells, copy the cell value from the expanded raster to the output.

Two-way expand and shrink

If the Run expansion and shrinking twice parameter is checked (the number_of_runs parameter is set to TWO_WAY in Python), a second expand and shrink process is performed, but this time the priorities will be reversed. The output from the first pass of the operation is used as input to the second pass.

In the first expand pass, the same logic that was used in the expand pass for one-way is used.

In the first shrink pass, the same logic that was used in the shrink pass for one-way is used.

In the second expand pass, the following occur:

  • For each processing cell in the internal raster generated from the first expand and shrink process, evaluate each neighbor cell.
  • For each neighbor cell, assess whether the priority value of that neighbor cell is greater than the priority value of the processing cell. If it is, assign the internal neighbor priority to be that of the input processing cell. Update the internal expanded raster with the new priority value, and proceed to the next neighbor cell.

In the second shrink pass, the following occur:

  • For each processing cell in the internal expanded raster from the previous step, evaluate each neighbor cell.
  • For each neighbor cell, if the priority value of the neighbor cell is less than or greater than the processing cell value in the expanded raster, copy the value of the processing cell from the original raster to the output.
  • If the priority value of the neighbor cell is equal to the processing cell value in the expanded raster, copy the value of the processing cell from the expanded raster to the output.

NoData handling

Input cells of NoData have the lowest priority when the expand and shrink process is run once, or in the second pass if the expand and shrink process is run twice. In the second pass of two-way sorting, cells of NoData will have the highest priority.

Example

To show the effects of various parameters on the output, consider the input raster below.

Example input raster for Boundary Clean

The example input raster for Boundary Clean is shown. NoData cells are gray.

The outputs for all settings of the Sort type parameter will be shown, for both settings of the Run expansion and shrinking twice parameter (unchecked or checked).

When the Sort type parameter is Do not sort, the output rasters are as follows:

Example output for Do not sort and One-way (unchecked) settings
One-way (unchecked)
Example output for Do not sort and Two-way (checked) settings
Two-way (checked)

When the Sort type parameter is Descending, the output rasters are as follows:

Example output for Descending and One-way (unchecked) settings
One-way (unchecked)
Example output for Descending and Two-way (checked) settings
Two-way (checked)

When the Sort type parameter is Ascending, the output rasters are as follows:

Example output for Ascending and One-way (unchecked) settings
One-way (unchecked)
Example output for Ascending and Two-way (checked) settings
Two-way (checked)

In this topic
  1. Generalize the edges