r3.out.vtk.html 6.3 KB

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