This document is archived and information here might be outdated.  Recommended version.


IGeneralizeOp.MajorityFilter Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (SpatialAnalyst)  

IGeneralizeOp.MajorityFilter Method

Replaces cells based upon the majority of their contiguous neighboring cells.

[Visual Basic .NET]
Public Function MajorityFilter ( _
    ByVal Raster As IGeoDataset, _
    ByVal useDiagonalNeighbors As Boolean, _
    ByVal halfIsMajority As Boolean _
) As IGeoDataset
[C#]
public IGeoDataset MajorityFilter (
    IGeoDataset Raster,
    bool useDiagonalNeighbors,
    bool halfIsMajority
);
[C++]
HRESULT MajorityFilter(
  IGeoDataset* Raster,
  VARIANT_BOOL useDiagonalNeighbors,
  VARIANT_BOOL halfIsMajority,
  IGeoDataset** MajorityFilter
);
[C++]

Parameters Raster [in]
Raster is a parameter of type IGeoDataset useDiagonalNeighbors [in] useDiagonalNeighbors is a parameter of type VARIANT_BOOL halfIsMajority [in] halfIsMajority is a parameter of type VARIANT_BOOL MajorityFilter [out, retval]
MajorityFilter is a parameter of type IGeoDataset

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Spatial Analyst Extension.

Remarks

raster

an input Raster, RasterDataset, RasterBand, or RasterDescriptor

useDiagonalNeighbors

a Boolean specifying the number of cells in the filter kernel

If True, then the kernel of the filter will be the eight nearest neighbors (a 3-by-3 window) to the present cell.

If False, then the kernel of the filter will be the four direct (orthogonal) neighbors to the present cell. This is the default.

halfIsMajority

a Boolean specifying the number of contiguous (spatially connected) cells that must be of the same value before a replacement will occur

If True, half of the cells must have the same value and be contiguous. Two out of four or four out of eight connected cells must have the same value. Half will have more of a smoothing effect.

If False, a majority of cells must have the same value and be contiguous. Three out of four or five out of eight connected cells must have the same value. This is the default.

 

See Also

IGeneralizeOp Interface