3
The module <em>r3.out.vtk</em> outputs 3D raster maps into VTK-ASCII format.
4
Maps are valid 3D raster maps in the current mapset search path. The
5
<em>output</em> parameter is the name of a VTK-ASCII file which will be
6
written in the current working directory. If <em>output</em> is not
7
specified then standard output (stdout) is used. The module is sensitive
8
to region settings (set with <em>g.region</em>).
12
This module generates <i>structured points</i> with <i>celldata</i>
13
(default) or <i>pointdata</i>. If top and bottom surfaces are requested
14
an <i>unstructured grid</i> with <i>celldata</i> or a <i>structured grid</i>
15
with <i>pointdata</i> is generated.
16
This data is put in a simple VTK-ASCII file. Neither XML nor
17
binary output are supported. It is possible to choose more then one 3D raster
19
to be written in the VTK-ASCII file. Each <i>celldata</i> is named as the
20
3D raster map it represents. The user can visualize this file with the
21
<em><a href="http://www.vtk.org">VTK Toolkit</a></em>,
22
<em><a href="http://www.paraview.org">ParaView</a></em> and
23
<em><a href="http://mayavi.sourceforge.net">MayaVi</a></em> which are based on
24
VTK. In case of 3D raster map with partially no data, the threshold filter in
25
ParaView can be used to visualize the valid data. Just filter all data which is
26
greater/lesser than the chosen null value in the VTK-ASCII file.
29
The top and bottom region values are expected in meters.
30
If a Latitude-Longitude (LL) coordinates are used, the elevation value for each
31
voxel will be converted into degrees.
34
The <em>input</em>, <em>rgbmaps</em> and <em>vectormaps</em> parameters are
35
optional, so only the geometry can be exported.
38
If the user defines <em>top</em> and <em>bottom</em> and the 2D and 3D region
39
values differ, the 2D resolution will be adjusted to the 3D resolution. The
40
elevation maps are expected in meters. If Lat/Long coordinates are used, the
41
elevation will automatically converted into degree.
42
If the surface and bottom maps are in a different unit than meters, use the
43
scale parameter to convert them into meters.
46
The RGB voxel data can be created from 2D raster maps (Landsat TM images)
47
with <em><a href="r.to.rast3.html">r.to.rast3</a></em>. The values of the RGB maps
48
must be within 0 and 255. If not, the values are automatically set
49
to 0 and warnings will be printed to stderr.
52
The vector data is created from three 3D raster maps. Each map represents a vector component.
53
So x, y and z components are required in this order. This data can be visualized with Glyph3d or
54
StreamTracer filters within Paraview.
57
If the <em>-c</em> flag is used and the data should be visualised together with
58
other data exported via <em>*.out.vtk</em> modules, be sure the <em>-c</em> flag
59
was also set in these modules. But this will only work with data from the SAME
60
location (the reference point for the coordinates transformation is based on the
61
center point of the default region).
63
<h3>Difference between point- and celldata</h3>
65
<em>r3.out.vtk</em> can export 3D raster maps with different representations.
67
<li> <em>pointdata</em> -- the cells/values are represented by the center of the
68
cell. Instead of cells, points are created. Each point can hold different
69
values, but the user can only visualize one value at a time.</li>
70
<li> <em>celldata</em> The cells are created with the same hight, width and depth
71
as in GRASS. Each cell can hold different values, but the user can only
72
visualize one value at a time.</li>
77
<h3>Simple Spearfish example</h3>
79
<div class="code"><pre>
81
g.region res=150 res3=150 t=80 b=0 tbres=10
82
r.mapcalc "bottom = 1800. - elevation.10m"
84
# synthetic data, could be geological structures:
85
r3.mapcalc "map3d = row()+col()+depth()"
87
#export of volume to VTK:
88
r3.out.vtk -s input=map3d top=elevation.10m bottom=bottom output=/tmp/out.vtk
90
# visualize in paraview or other VTK viewer:
91
paraview --data=/tmp/out.vtk
94
<h3>Spearfish example with RGB data</h3>
96
<div class="code"><pre>
99
g.region n=4926970 s=4914857 w=591583 e=607793 res=50 res3=50 t=80 b=0 tbres=10
101
#create a bottom surface
102
r.mapcalc "bottom = 1800. - elevation.10m"
104
# synthetic data, could be geological structures:
105
r3.mapcalc "map3d = row()+col()+depth()"
107
#get some satellite images with r.in.onearth
108
r.in.onearth -l output=Sat tmband=Red
109
r.in.onearth -l output=Sat tmband=IR1
110
r.in.onearth -l output=Sat tmband=IR2
112
#Convert the 2d maps to 3d raster maps with r.to.rast3
113
r.to.rast3 input=SatLandsatTM_Red output=SatLandsatTM_Red
114
r.to.rast3 input=SatLandsatTM_IR1 output=SatLandsatTM_IR1
115
r.to.rast3 input=SatLandsatTM_IR2 output=SatLandsatTM_IR2
117
#export of volume to VTK:
118
r3.out.vtk -s rgbmaps=SatLandsatTM_IR1,SatLandsatTM_IR2,SatLandsatTM_Red
119
input=map3d top=elevation.10m bottom=bottom output=/tmp/out.vtk
121
# visualize in paraview or other VTK viewer:
122
paraview --data=/tmp/out.vtk
125
<h3>Spearfish example with vector data</h3>
127
<div class="code"><pre>
130
g.region n=4926970 s=4914857 w=591583 e=607793 res=50 res3=50 t=80 b=0 tbres=10
132
# create a bottom surface
133
r.mapcalc "bottom = 1800. - elevation.10m"
135
# synthetic data, could be geological structures:
136
r3.mapcalc "map3d = row()+col()+depth()"
138
# synthetic vector data, could be groundwater stream vectors
139
r3.mapcalc "x_part = sin(row())"
140
r3.mapcalc "y_part = cos(col())"
141
r3.mapcalc "z_part = sin(depth())"
144
# export the stuff data to VTK:
145
r3.out.vtk -s vectormaps=x_part,y_part,z_part input=map3d top=elevation.10m
146
bottom=bottom output=/tmp/out.vtk
148
# visualize in paraview or other VTK viewer:
149
paraview --data=/tmp/out.vtk
150
# Now use the Glyph and Stream-Trace Filter to get nice vectors and streamlines
154
<h3>Slovakia3d example</h3>
156
<div class="code"><pre>
158
g.region -dp3 res=1000 res3=1000
159
r.mapcalc "bottom = 100"
161
#export of volume to VTK:
162
r3.out.vtk -s in=precip3d.500z50 top=dem500 bottom=bottom
163
out=/tmp/slovakia3d.vtk
165
# visualize in paraview or other VTK viewer:
166
paraview --data=/tmp/slovakia3d.vtk
167
# set Display style to 'surface#
168
# set Actor Control z to 10
174
<a href="r.out.vtk.html">r.out.vtk</a>,
175
<a href="r3.out.ascii.html">r3.out.ascii</a>,
176
<a href="g.region.html">g.region</a>
182
<p><i>Last changed: $Date: 2011-09-13 22:13:36 +0200 (Tue, 13 Sep 2011) $</i>