[vtkusers] Problem getting correct results with vtkProjectedTerrainPath
Elvis Dowson
elvis.dowson at mac.com
Mon Nov 10 13:21:57 EST 2008
Hi Amy,
Could you please help me out by giving me a code
fragment on how to achieve this? I have created an outline below.
I've created a vtkImageData and set it's dimensions by reading the max
extent of the original DEM file. I hope that is correct. Now
vtkProjectedPath::SetSource(vtkImageData* ) expects a vtkImageData*,
and I don't know how to pass the vtkImageData object called
elevationData to this method. I have highlighted it in red below.
I have put the wrap scalar code fragment below. Could you please help
me with a code fragment to extract the vtkImageData from the wrap
scalar output?
# Create a reader to read the unstructured grid data.
vtkDataSetReader reader
reader SetFileName "SampleDEM.vtk"
# Get the physical xy extent of dataset
scan [[reader GetOutput] GetWholeExtent] "%d %d %d %d %d %d" XminR
XmaxR YminR YmaxR ZminR ZmaxR
..
# Now warp the surface based on the scalar elevation values
# This creates the 3D mesh model of the terrain.
vtkWarpScalar surface
surface SetInput [geom GetOutput]
surface SetScaleFactor 0.1; # $scale variable controls vertical
exaggeration
....
# Use a probe filter to obtain elevation data from the reconstructed
surface
vtkImageData elevationData
elevationData SetDimensions $XmaxR $YmaxR $ZmaxR
#vtkProbeFilter
vtkProjectedTerrainPath projectedPaths
projectedPaths SetInput terrainPaths
projectedPaths SetSource [elevationData]
projectedPaths SetHeightOffset 25
projectedPaths SetHeightTolerance 5
projectedPaths SetProjectionModeToNonOccluded
projectedPaths SetProjectionModeToHug
Best regards,
Elvis Dowson
On Nov 10, 2008, at 6:31 PM, Amy Squillacote wrote:
> Hi Elvis,
>
> You could try using a vtkProbeFilter: http://www.vtk.org/doc/nightly/html/classvtkProbeFilter.html
> . Create an empty vtkImageData (sized and positioned to encompass
> the output of your vtkWarpScalar filter), and pass it as the
> "source" (2nd input) to vtkProbeFilter.
>
> - Amy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081110/70d5e8f5/attachment.htm>
More information about the vtkusers
mailing list