1r.thin(1)                   GRASS GIS User's Manual                  r.thin(1)
2
3
4

NAME

6       r.thin   - Thins non-null cells that denote linear features in a raster
7       map layer.
8

KEYWORDS

10       raster, geometry
11

SYNOPSIS

13       r.thin
14       r.thin --help
15       r.thin  input=name  output=name   [iterations=integer]    [--overwrite]
16       [--help]  [--verbose]  [--quiet]  [--ui]
17
18   Flags:
19       --overwrite
20           Allow output files to overwrite existing files
21
22       --help
23           Print usage summary
24
25       --verbose
26           Verbose module output
27
28       --quiet
29           Quiet module output
30
31       --ui
32           Force launching GUI dialog
33
34   Parameters:
35       input=name [required]
36           Name of input raster map
37
38       output=name [required]
39           Name for output raster map
40
41       iterations=integer
42           Maximal number of iterations
43           Default: 200
44

DESCRIPTION

46       r.thin  scans the named input raster map layer and thins non-NULL cells
47       that denote linear features into linear features having a  single  cell
48       width. Raster lines often need to be thinned (skeletonizing raster fea‐
49       tures) to a single pixel width before they can be transformed to vector
50       data.
51
52       r.thin  will thin only the non-NULL (no data) raster cells of the named
53       input raster map layer within the current geographic  region  settings.
54       The  cell width of the thinned output raster map layer will be equal to
55       the cell resolution of the currently set geographic region.  All of the
56       thinned linear features will have the width of a single cell.
57
58       r.thin will create a new output raster data file containing the thinned
59       linear features.  r.thin assumes that linear features are encoded  with
60       positive  values  on  a  background  of NULL’s in the input raster data
61       file, hence it creates a NULL/1 output map.
62

NOTES

64       r.thin only creates raster map layers. In order to create a vector map,
65       the user will need to run r.to.vect on the resultant raster map.
66
67       r.thin  may  create small spurs or "dangling lines" during the thinning
68       process.  These spurs may be  removed  (after  creating  a  vector  map
69       layer) by v.clean (rmdangle tool).
70
71       This  code  implements the thinning algorithm described in "Analysis of
72       Thinning Algorithms Using Mathematical Morphology" by Ben-Kwei Jang and
73       Ronlad T. Chin in Transactions on Pattern Analysis and Machine Intelli‐
74       gence, vol. 12, No. 6, June 1990.  The definition Jang and Chin give of
75       the  thinning  process is "successive removal of outer layers of pixels
76       from an object while retaining any pixels whose removal would alter the
77       connectivity or shorten the legs of the sceleton."
78
79       The  sceleton  is  finally thinned when the thinning process converges;
80       i.e., "no further pixels can be removed without altering the connectiv‐
81       ity  or shortening the sceleton legs" (p. 541).  The authors prove that
82       the thinning process described always converges and produces  one-pixel
83       thick  sceletons.   The  number  of  iterations depends on the original
84       thickness of the object.  Each iteration peels off the  outside  pixels
85       from  the  object.   Therefore, if the object is <= n pixels thick, the
86       algorithm should converge in <= iterations.
87

EXAMPLE

89       To vectorize the raster map streams_derived in the North Carolina  sam‐
90       ple  dataset  that  represents  the stream network derived from the 10m
91       resolution DEM by r.watershed, run:
92       g.region raster=elevation -p
93       # create flow accumulation map
94       r.watershed elevation=elevation accumulation=accum_50K thresh=50000
95       # extract streams from flow accumulation map
96       r.mapcalc "streams_from_flow = if(abs(accum_50K) > 1000, 1, null())"
97       # skeletonize map
98       r.thin streams_from_flow out=streams_thin
99       d.mon wx0
100       d.rast streams_from_flow
101       d.erase
102       d.rast streams_thin
103
104       Raster feature thinning (skeletonizing)
105
106       The resulting map cabe optionally vectorized:
107       r.to.vect streams_thin output=streams_thin type=line
108       # visualize
109       d.rast accum_50K
110       d.vect streams_thin color=red width=2
111
112       Vectorized stream network after thinning extracted from flow  accumula‐
113       tion map
114

SEE ALSO

116        g.region, r.to.vect, v.clean, wxGUI vector digitizer, v.build
117

AUTHOR

119       Olga Waupotitsch, U.S.Army Construction Engineering Research Laboratory
120
121       The  code for finding the bounding box as well as input/output code was
122       written by Mike Baba (DBA  Systems,  1990)  and  Jean  Ezell  (USACERL,
123       1988).
124

SOURCE CODE

126       Available at: r.thin source code (history)
127
128       Main  index  | Raster index | Topics index | Keywords index | Graphical
129       index | Full index
130
131       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
132
133
134
135GRASS 7.8.5                                                          r.thin(1)
Impressum