Variable threshold computation

Functionality

The Variable threshold computation operation helps you to prepare a threshold map that can be used in the Drainage network extraction operation.

You can base the threshold map on a height map (DEM), or on attribute values from an attribute table of a raster map with a class or ID domain (e.g. infiltration attribute values in a table linked to a geological unit map).

As a user, you have to:

When height values are used as input, you can optionally obtain an internal relief map as additional output.

Brief explanation of the algorithm:

Suppose that you use a 3 x 3 kernel.

 

  1. First, the 3 x 3 kernel moves over the input values and determines the maximum difference between each 9 input values. When you use height values as input, this is the calculation of the internal relief.
  2. Subsequently, these maximum difference values are classified into several user-defined classes. Each class is assigned the threshold value that was specified for this class.
  3. Finally, for generalization purposes, the 3 x 3 kernel moves over the map from the previous step: the predominant value of each 9 temporary threshold values is found and this threshold value is assigned to the output pixel.

When using a 5 x 5 kernel, 25 input pixels are considered at a time, etc.

Below, you will find some examples and a more detailed explanation of these 3 steps.

Input map requirements:

The operation requires an input Digital Elevation Model (DEM) (value raster map).

You can also use a class or ID map and choose a (value) attribute column from the attribute table that is linked to this map. In this way, you can base the output threshold map for instance on infiltration (attribute) values of geological units (map), etc.

Domain and georeference of output maps:

The output threshold map and the optional internal relief output map will use system domain Value; the value range and precision for the output maps are automatically calculated.

An output internal relief map will obtain the same name as the output threshold map, followed by __1.

The output maps will use the same georeference as the input map.

 

Tip: The output threshold map of this operation can be used as input threshold map in a Drainage network extraction operation.

Examples

1. Simple example:

 

In this example, a relatively flat part of a DEM is used.

Consider the following 9 pixels in a DEM:

 

2060

2055

2052

2056

2051

2051

2050

2047

2046

 

Internal relief:

The internal relief value, for the center pixel, is: maximum - minimum = 2060 - 2046 = 14.
This value is the output value that is assigned to the 'center' pixel in the internal relief map below (in bold).
For your reference, the internal relief values calculated for the other pixels are also shown.

 

16

10

10

17

14

13

12

13

13

 

Classification:

The upper boundary values were set to 25 and 75.

In this case, the internal relief value is 14, thus the output threshold value will be 750 (in bold below).
For your reference, the classified threshold values for the other pixels are also shown.

 

750

750

750

750

750

750

750

750

750

 

Predominant threshold value:

From the pixel values above, it is easily seen that the predominant value is 750.
This is the final output value that will be assigned to the pixel in the output threshold map (in bold below).

 

depends

  750

depends

750

  750

750

depends

  750

depends

For the final output values of the neighbours, the following can be said:

 

2. More complicated example:

In this example, a part of a DEM is used in which the internal relief values are just below and just above the first boundary value of 25.

Consider the input DEM below.

 

 

A 3x3 filter was used to determine internal relief values. The internal relief map is shown below.

 

 

The same classification was used as in the simple example:

However, because the predominant value (of the 3x3 window) is assigned, the output is as follows:

 

 

Explanation of the operation's process

1. Calculation of internal relief values:

A kernel (filter) with a user-defined size, e.g. 3 x 3, 5 x 5, etc., will move over the input map. Each time, only the 9, 25, etc. pixel values 'within' the kernel are considered. When an output value is obtained, the kernel moves 1 pixel to the right, until all pixels in a row are done. This is repeated for all rows.

 

The filter size has to be specified in the operation's dialog box or on the command line:

  • any odd size can be used,
  • filters are always symmetrical, e.g. 3 x 3, 5 x 5, etc.
  • if an even value is specified for the filter size, this value is automatically increased by 1, so that an odd size is obtained,
  • if a filter size < 3 is used, the program will automatically use a 3 x 3 kernel.

From the 9, 25, etc. input values considered, the minimum value and the maximum value are found. The difference between the maximum value and the minimum value is the internal relief:

 

Internal relief = MAX - MIN

This value is assigned to the corresponding pixel, at the center of the kernel, in the optional internal relief output map.

For more information, see also Filter (operation) : functionality or Neighbourhood operations (section Using neighbourhood functions on multiple neighbours), and/or Neighbourhood functions NBMAX and NBMIN.

 

The output internal relief map, using a 3x3 filter size, could be created 'manually' by using:

 

MaximumValuesMap = NBMAX(InputDEM#)
MinimumValuesMap = NBMIN(InputDEM#)
InternalReliefMap = MaximumValuesMap - MinimumValuesMap

2. Reclassification of internal relief values into output threshold values:

The user has to specify upper boundary values for the internal relief values and has to specify output values for these internal relief classes.

For instance, an internal relief value map contains values between 0 and 450.

Suppose, you wish to divide these internal relief values into 3 classes:

You should then use the following upper boundary values and output threshold values:

 

Upper bound value

Output threshold value

30

1000

80

250

500

50

The maximum number of output classes that can be specified is 5.

Note:

The upper boundary value of the last class should be large enough to fit 'all' internal relief values. If an internal relief value is found that is greater than the last upper boundary value, then such a pixel will not be classified and will thus obtain output value undefined.

 

To prevent this, it is advised to specify for the last upper boundary value:

 

      Maximum value in your entire DEM - Minimum value in your entire DEM

 

In this way, you ensure that no additional undefined values will appear in your output map.

3. Assigning the predominant output value 'within the filter' to the output pixel:

Finally, the filter with your user-defined size, e.g. 3 x 3, 5 x 5, etc., will move over the output map with the threshold values from step 2. Each time, only the pixel values 'within' the filter are considered.

From these values, while any pixels with value undefined are ignored, the predominant value is determined. This predominant value is then assigned to the corresponding pixel, at the center of the filter, in the final output map.

Then, the filter moves on to the next pixel.

By assigning the predominant threshold value:

For more information, see Majority filter, or Neighbourhood operations (section Using neighbourhood functions on multiple neighbours), and Neighbourhood function NBPRD.

See also: