r3.out.vtk.1grass

Langue: en

Version: 312032 (ubuntu - 07/07/09)

Section: 1 (Commandes utilisateur)

NAME

r3.out.vtk

DESCRIPTION

Outputs G3D maps in VTK-ASCII format. Map's are valid G3D map's in the current mapset. output is the name of an VTK-ASCII file which will be written in the current working directory. If output is not specified then stdout is used. The module is sensitive to region settings (set with g.region).

NOTES

This filter generates structured points with celldata (default) or pointdata. If top and bottom surfaces are requested a unstructured grid with celldata or a structured grid with pointdata is generated. This data is put in a simple VTK-ASCII file. Nor XML or binary output are supported. It is possible to choose more then one G3D map to be written in the VTK-ASCII file. Each celldata is named like the G3D map it represents. You can visualize this file with the VTK Toolkit, Paraview and MayaVi which are based on VTK. If you have a G3D map with partly no data, use the threshold filter in paraview to visualize the valid data. Just filter all data which is greater/lesser than the choosen null value in the VTK-ASCII file.
The input, rgbmaps and vectormaps are optional, so only the geometry can be exported.
If you use top and bottom and the 2d and 3d region settings are different, the 2d resolution will be adjust to the 3d resolution.
The RGB voxel data can be created from 2d raster maps (Landsat TM images) with r.to.rast3. The values of the RGB maps must be within 0 and 255. Whether not, the values are set automaticly to 0 and warnings will be printed to stderr.
The vector data is created from three g3d maps. Each map represents a vector component. So x, y and z components are required in this order! This data can be visualized with Glyph3d or StreamTracer filters within Paraview.

If the "-c" flag is used and the data should be visualised together with other data exported via *.out.vtk modules, be sure the "-c" flag was also set in these modules. But this will only work with data from the SAME location (The reference point for the coordinates transformation is based on the default region).

Difference between point- and celldata

r3.out.vtk can export G3D cells with different representations.
pointdata -- the cells/values are represented by the center of the cell. Instead of cells, points are created. Each point can hold different values, but the user can only visualize one value at a time.
celldata The cells are created with the same hight, width and depth as in GRASS. Each cell can hold different values, but the user can only visualize one value at a time.

EXAMPLE

Simple Spearfish example


g.region -d
g.region res=150 res3=150 t=80 b=0 tbres=10
r.mapcalc "bottom=1800. - elevation.10m"

# synthetic data, could be geological structures:
r3.mapcalc "map3d=row()+col()+depth()"

#export of volume to VTK:
r3.out.vtk -s input=map3d top=elevation.10m bottom=bottom output=/tmp/out.vtk

# visualize in paraview or other VTK viewer:
paraview --data=/tmp/out.vtk

Spearfish example with RGB data


#set the region
g.region -d
g.region n=4926970 s=4914857 w=591583 e=607793 res=50 res3=50 t=80 b=0 tbres=10

#create a bottom surface
r.mapcalc "bottom=1800. - elevation.10m"

# synthetic data, could be geological structures:
r3.mapcalc "map3d=row()+col()+depth()"

#get some satellite images with r.in.onearth
r.in.onearth -l output=Sat tmband=Red
r.in.onearth -l output=Sat tmband=IR1
r.in.onearth -l output=Sat tmband=IR2

#Convert the 2d maps to g3d maps with r.to.rast3
r.to.rast3 input=SatLandsatTM_Red output=SatLandsatTM_Red
r.to.rast3 input=SatLandsatTM_IR1 output=SatLandsatTM_IR1
r.to.rast3 input=SatLandsatTM_IR2 output=SatLandsatTM_IR2

#export of volume to VTK:
r3.out.vtk -s rgbmaps=SatLandsatTM_IR1,SatLandsatTM_IR2,SatLandsatTM_Red input=map3d top=elevation.10m bottom=bottom output=/tmp/out.vtk

# visualize in paraview or other VTK viewer:
paraview --data=/tmp/out.vtk

Spearfish example with vector data


# set the region
g.region -d
g.region n=4926970 s=4914857 w=591583 e=607793 res=50 res3=50 t=80 b=0 tbres=10

# create a bottom surface
r.mapcalc "bottom=1800. - elevation.10m"

# synthetic data, could be geological structures:
r3.mapcalc "map3d=row()+col()+depth()"

# synthetic vector data, could be groundwater stream vectors
r3.mapcalc "x_part =sin(row())"
r3.mapcalc "y_part =cos(col())"
r3.mapcalc "z_part =sin(depth())"


# export the stuff data to VTK:
r3.out.vtk -s vectormaps=x_part,y_part,z_part input=map3d top=elevation.10m bottom=bottom output=/tmp/out.vtk

# visualize in paraview or other VTK viewer:
paraview --data=/tmp/out.vtk
# Now use the Glyph and Stream-Trace Filter to get nice vectors and streamlines

Slovakia3d example


#reduce resolution:
g.region -dp3 res=1000 res3=1000
r.mapcalc "bottom=100"

#export of volume to VTK:
r3.out.vtk -s in=precip3d.500z50 top=dem500 bottom=bottom out=/tmp/slovakia3d.vtk

# visualize in paraview or other VTK viewer:
paraview --data=/tmp/slovakia3d.vtk
# set Display style to 'surface#
# set Actor Control z to 10

SEE ALSO

r.out.vtk
r3.out.ascii
g.region

AUTHOR

Soeren Gebbert

Last changed: $Date: 2006/06/16 18:10:54 $

Full index