Calculating terrain analysis indices

Skip to end of sidebar Go to start of sidebar
Skip to end of metadata
Go to start of metadata

When performing terrain analysis and bathymetry, there are a few values which are useful for analysis. I won't go into the details on how to apply these indices, but I will show a couple of ways to calculate them in Opticks. All three of these indices involve a moving window calculation (convolution). These routines all require elevation information in a RasterElement, from a DTED file for example.

Roughness

The roughness index is calculated by taking the height difference between the pixel at the center of the annulus and all other pixels in the annulus. The largest difference is the roughness index for the center pixel. Below is an example which uses the Python extension with the Scipy Python package. The generic_filter function passes the annulus as a one dimensional array and the extra_arguments parameter is used to pass the index of the center pixel in the annulus.

Topological Ruggedness Index (TRI)

Similar to the roughness index, the TRI is calculated by taking the height difference between the pixel at the center of the annulus and all other pixels in the annulus. Instead of selecting the largest difference, the mean of the differences is calculated as the TRI. Below is a routine which calculates TRI using Python.

Topological Position Index (TPI)

The TPI is similar to the TRI but instead of calculating the average of the height differences, we calculate the difference between the center pixel height and the average of the other pixels in the annulus. The Python code is very to the previous examples and is displayed below.

Real time calculation

It's also possible to calculating these indices in real-time on a GPU by using the Cg filter functionality in Opticks. A number of files need to be created and placed in your Opticks install before starting Opticks. The Cg programs for the TRI and TPI are shown below. Instead of using a 9x9 moving window, a smaller 3x3 is used in these examples in order to reduce the number of lines of code. The size can be increased by adding new terms. A smaller window results in a more details, "higher resolution" index map. Roughness is left as an exercise for the reader.

Place in SupportFiles/Cg/TRI.cg

Place in SupportFiles/Cg/TPI.cg

Place in SupportFiles/ImageFilters/Terrain.gic

Start Opticks and load a DTED. In the RasterLayer properties, enable GPU filters and select the index program. You will need to manually adjust the stretch since the histogram is calculated for the original data and not the index data. Try a raw stretch of -100 to 100 as a starting point.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.