[vtkusers] Problem getting correct results with vtkProjectedTerrainPath

Amy Squillacote ahs at cfdrc.com
Mon Nov 10 15:19:42 EST 2008


Hi Elvis,

The code you wrote looks right to me. I don't know if this will make any 
difference, but have you tried using vtkAlgorithm's SetInputConnection 
method (that takes two parameters) instead of SetInput / SetSource in 
both the vtkProbeFilter and vtkProjectedTerrainPath? SetInput should be 
replaced by SetInputConnection 0..., and SetSource by SetInputConnection 
1...

- Amy

Elvis Dowson wrote:
> Hi Amy,
>                 Is this the correct way to do it? I'm getting an 
> interpreter error for vtkProjectTerrainPath::SetSource(vtkImageData* )
>
> vtkPolyData terrainPaths
>   terrainPaths SetPoints pts
>   terrainPaths SetLines lines
>
> # Use a probe filter to obtain elevation data from the reconstructed 
> surface
> vtkImageData elevationData
>   elevationData SetDimensions $XmaxR $YmaxR $ZmaxR
>
> vtkProbeFilter probe 
>   probe SetInput  [surface GetOutput]
>   probe SetSource elevationData
>
> vtkProjectedTerrainPath projectedPaths
>   projectedPaths SetInput terrainPaths
>   projectedPaths SetSource [probe GetOutput]
>
> Best regards,
>
> Elvis Dowson
>
>
> On Nov 10, 2008, at 10:21 PM, Elvis Dowson wrote:
>
>> 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
>>
>>

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list