r3.out.vtk.html 6.3 KB

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