FMO -- Mode Filter (up to 7x7)

Performs MODE filtering on image data. The Mode filter is primarily used to clean up thematic maps for presentation purposes.

See Also: FAV, FED, FME, FGA, FPR, FLE, FSOBEL, FPRE, FSHARP

INPUT PORTS

Input

Type:Raster
Connection:Mandatory
Minimum Layers:1
Maximum Layers:1

Contains the input raster layer to be filtered.

Mask

Type:Bitmap
Connection:Optional
Minimum Layers:0
Maximum Layers:1

Contains the input bitmap layer that indicates the area under which the input raster should be processed. If no bitmap is connected the entire window is filtered.

OUTPUT PORT(S)

Output

Type:Raster
Connection:Optional
Minimum Layers:0
Maximum Layers:1

Contains the output layer that will receive the filtered raster after module execution.

INPUT PARAMETERS

FMO is controlled by the following parameters:

Filter X Size (Pixels)

Name:FilterXSize
Type:Integer
Valid Values:1, 3, 5, 7
Default:3
Requirement:Mandatory

Specifies the filter's X size in units of pixels.

Notes:

Filter Y Size (Lines)

Name:FilterYSize
Type:Integer
Valid Values:3, 5, 7
Default:3
Requirement:Mandatory

Specifies the filter's Y size in units of lines.

Notes:

Thin Line Preservation

Name:ThinLine
Type:Text
Valid Values:ON, OFF
Default:ON
Requirement:Mandatory

Specifies whether thin line preservation is to be applied to the data.

Notes:

Exclude Values List (Max. 16)

Name:KeepValue
Type:Integer
Valid Values:x >= 0
Default:<none>
Requirement:Optional

Specifies up to 16 pixel values (classes) which should not be filtered. Although these classes will not be replaced during the filtering process, other pixels could 'take on' these values as a result of filtering.

DETAILS

The mode filter computes the mode of the grey-level values (the most frequently occurring grey-level value) within the filter window surrounding each pixel. Mode filtering is ideal for cleaning up thematic maps for presentation purposes, in that it replaces small "island" themes by their larger, surrounding themes. The minimum filter size is 1 by 3 (or 3 by 1), and the maximum filter size allowed is 7 by 7. The filter window does not need to be square.

If the thinline preservation flag (ThinLine) is ON, a pixel is mode filtered only if the number of occurrences of the centre pixel value in the 3 by 3 window surrounding it is less than 3. ThinLine can be set "ON" only for a 3x3 filter window. This ensures that thin classes (such as streams or roads) are not removed when cleaning up thematic maps.

The KeepValue parameter specifies up to 16 values (classes) which should not be filtered. This is useful for preserving specified classes.

A bitmap mask specifies the area within the input layer which will be processed. Only areas under the mask will be filtered and the rest of the image will be unchanged. If no bitmap is connected, the entire database is processed.

ALGORITHM

The implementation of the mode filter consists of computing the mode of the grey-level values (the most frequently occurring grey-level value) within the square or rectangular filter window surrounding each pixel.

All pixels are filtered. In order to filter pixels located near the edges of the image, edge pixel values are replicated to give sufficient data.

                +---------+
                | 5  3  3 |    
                | 3  5  3 |     <-- Filter window
                | 3  4  5 |         3x3
                +---------+
When Thinline = "OFF" the output pixel is equal to the most frequently occurring value in the filter window.

 i.e. Thinline = "OFF" 
         Filtered pixel of filter window (3,3,3,3,3,4,5,5,5) 
         is set to 3, which occurs 5 times.
When Thinline = "ON" , in order to preserve thin lines in the image, the central pixel is filtered only if the grey-level value of the central pixel occurs less than three times within the 3x3 filter window.

 i.e. Thinline = "ON" 
         Filtered pixel of filter window (3,3,3,3,3,4,5,5,5)
         is set to 5, central pixel 5 occurs 3  times.
Example of using 5x5 filter on database image 8x8, Thinline="OFF"

     Image Before Filtering        Image After Filtering

   8 8  8 9 9 9 7 6 6 6   6 6
   8 8  8 9 9 9 7 6 6 6   6 6
       +----------------+           +----------------+
   8 8 |8 9 9 9 7 6 6 6 | 6 6       |8 9 9 6 6 6 6 6 |
   8 8 |8 9 9 7 6 6 6 6 | 6 6       |8 9 9 6 6 6 6 6 |   
   9 9 |9 8 8 6 6 6 6 6 | 6 6       |9 7 7 6 6 6 6 6 |
   9 9 |9 8 7 7 6 5 6 6 | 6 6       |9 7 6 6 6 6 6 6 |
   7 7 |7 7 7 6 6 6 6 6 | 6 6       |6 6 6 6 6 6 6 6 |
   6 6 |6 6 6 6 6 6 6 6 | 6 6       |6 6 6 6 6 6 6 6 |   
   6 6 |6 6 6 6 6 6 6 5 | 5 5       |6 6 6 6 6 6 6 6 |
   6 6 |6 6 6 6 6 6 6 6 | 6 6       |6 6 6 6 6 6 6 6 |
       +----------------+           +----------------+        
   6 6  6 6 6 6 6 6 6 6   6 6      
   6 6  6 6 6 6 6 6 6 6   6 6
For the case where the filter does not have a full window (see the "Image Before Filtering" on the left), columns and scanlines outside the box represent the last image column or scanline being reused.


About PCI Help Gateway