3
<em>r.mfilter</em> filters the raster <em>input</em> to produce the
4
raster <em>output</em> according to the matrix <em>filter</em> designed
5
by the user (see <em>FILTERS</em> below).
6
The filter is applied <em>repeat</em> times (default <em>value</em> is 1).
7
The <em>output</em> raster map layer can be given a <em>TITLE</em> if desired.
8
(This TITLE should be put in quotes if it contains more than one word.)
10
With <b>-z</b> flag the filter is applied only to null values in
11
the input raster map layer. The non-null category values are not changed.
12
Note that if there is more than one filter step, this rule is applied to the
13
intermediate raster map layer -- only null category values which result from
14
the first filter will be changed. In most cases this will NOT be the
15
desired result. Hence -z should be used only with single step filters.
17
The <b>filter</b> parameter defines the name of an existing, user-created
18
UNIX ASCII file whose contents is a matrix defining the way in which the
19
<em>input</em> file will be filtered. The format of this file is described
22
The <b>repeat</b> parameter defines the number of times the <em>filter</em>
23
is to be applied to the <em>input</em> data.
27
The <em>filter</em> file is a normal UNIX ASCII file designed by the user.
28
It has the following format:
29
<div class="code"><pre>
42
<dd>A one-line TITLE for the filter.
43
If a TITLE was not specified on the command line, it can be specified here.
44
This TITLE would be used to construct a TITLE for the resulting raster map
45
layer. It should be a one-line description of the filter.
49
<dd>The matrix (n x n) follows on the next n lines. <em>n</em> must be
50
an odd integer greater than or equal to 3.
51
The matrix itself consists of n rows of n values.
52
The values must be separated from each other by at least 1 blank.
56
<dd>The filter divisor is <em>d</em>. If not specified, the default is 1.
57
If the divisor is zero (0), then the divisor is dependent on the
58
category values in the neighborhood
59
(see HOW THE FILTER WORKS below).
63
<dd>The filter type. <em>S</em> means sequential, while <em>P</em> mean parallel.
64
If not specified, the default is S.
68
Sequential filtering happens in place. As the filter is applied to the
69
raster map layer, the category values that were changed in neighboring
70
cells affect the resulting category value of the current
74
<p>Parallel filtering happens in such a way that the original raster
75
map layer category values are used to produce the new category value.
78
<p>More than one filter may be specified in the filter file.
79
The additional filter(s) are described just like the first.
80
For example, the following describes two filters:
86
<h2>EXAMPLE FILTER FILE</h2>
88
<div class="code"><pre>
89
TITLE 3x3 average, non-null data only, followed by 5x5 average
107
<h2>HOW THE FILTER WORKS</h2>
109
The filter process produces a new category value for each cell
110
in the input raster map layer by multiplying the category values of the
111
cells in the n x n neighborhood around the center cell
112
by the corresponding matrix value and adding them together.
113
If a divisor is specified, the sum is divided by this divisor.
114
(If a zero divisor was specified, then
115
the divisor is computed for each cell as the sum of the MATRIX
116
values where the corresponding input cell is non-null.)
120
If more than one filter step is specified, either because the
121
repeat value was greater than one or because the filter file
122
contained more than one matrix, these steps are performed
123
sequentially. This means that first one filter is applied to
124
the entire input raster map layer to produce an intermediate result;
125
then the next filter is applied to the intermediate result to
126
produce another intermediate result; and so on, until the
127
final filter is applied. Then the output cell is written.
131
If the resolution of the geographic region does not agree with the
132
resolution of the raster map layer, unintended resampling of the original
133
data may occur. The user should be sure that the geographic region
138
<em><a href="g.region.html">g.region</a></em>,
139
<em><a href="r.clump.html">r.clump</a></em>,
140
<em><a href="r.neighbors.html">r.neighbors</a></em>
141
<em><a href="r.mfilter.html">r.mfilter</a></em>
146
Based upon r.mfilter, by Michael Shapiro,
147
U.S.Army Construction Engineering Research Laboratory
149
<p><i>Last changed: $Date: 2014-12-12 00:16:30 +0100 (Fri, 12 Dec 2014) $</i>