Majority Filter (Spatial Analyst Tools)
Summary
Replaces cells in a raster based on the majority of their contiguous neighboring cells.
Illustration

Usage
The Majority Filter tool must satisfy two criteria before a replacement can occur. The number of neighboring cells of a similar value must be large enough (either by being the majority of, or half of, all the cells), and those cells must be contiguous about the center of the filter kernel. The second criteria concerning the spatial connectivity of the cells minimizes the corruption of cellular spatial patterns.
Using four for the number of neighbors will retain the corners of rectangular regions. Using eight neighbors will smooth the corners of rectangular regions.
With the number of neighbors set to eight, contiguous is defined as sharing an edge. With the number of neighbors set to four, contiguous is defined as sharing a corner.
If the Replacement threshold parameter is set to Half and two values occur as equal portions, no replacement will occur if the value of the processing cell is the same as one of the halves. The Half option allows more extensive filtering than the Majority option.
While the contiguity criterion is the same for edge and corner raster cells, they obey different rules for the Majority and Half options. When the number of neighbors to be used is four, an edge or corner cell always requires two matching neighbors before replacement will occur. With eight neighbors, a corner cell must have all neighbors of the same value before it is changed, while an edge cell requires three contiguous neighbors, including one along the edge, before any change will occur.
The output raster will be stabilized (will no longer change) after a few runs of Majority Filter.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Parameters
| Label | Explanation | Data type |
|---|---|---|
|
Input raster |
The input raster to be filtered based on the majority of contiguous neighboring cells. It must be of integer type. |
Raster Layer |
|
Number of neighbors to use (Optional) |
Determines the number of neighboring cells to use in the kernel of the filter.
|
String |
|
Replacement threshold (Optional) |
Specifies the number of contiguous (spatially connected) cells that must be of the same value before a replacement will occur.
|
String |
Return value
| Label | Explanation | Data type |
|---|---|---|
|
Output raster |
The output filtered raster. The output is always of integer type. |
Raster |
Environments
Auto Commit, Cell Size, Cell Size Projection Method, Compression, Current Workspace, Extent, Geographic Transformations, Mask, Output CONFIG Keyword, Output Coordinate System, Scratch Workspace, Snap Raster, Tile Size
Licensing information
- Basic: Requires Spatial Analyst
- Standard: Requires Spatial Analyst
- Advanced: Requires Spatial Analyst