[vtkusers] Problem getting correct results with vtkProjectedTerrainPath

Amy Squillacote ahs at cfdrc.com
Tue Nov 11 09:04:33 EST 2008


What version of VTK are you using? That method should be there both in 
5.2 and in CVS.

- Amy

Elvis Dowson wrote:
> Hi Amy,
>                   I'm getting the following error: 
>
> Object named: probe, could not find requested method: SetInputConnection
> or the method was called with incorrect arguments.
>
> Object named: probe, could not find requested method: SetInputConnection
> or the method was called with incorrect arguments.
>
>     while executing
> "probe SetInputConnection 0 elevationData"
>     (file 
> "/Users/elvis/Project/C4I/Source/tcl/LewistownPA/TestSurfaceTopographyWithProjectedPath.tcl" 
> line 174)
>
>
> for the modified code:
>
> 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 SetInputConnection 0 elevationData
>   probe SetSourceConnection [surface GetOutputPort] 
>
> vtkProjectedTerrainPath projectedPaths
>   projectedPaths SetInput terrainPaths
>   projectedPaths SetInputConnection 1 [probe GetOutput]
>   projectedPaths SetHeightOffset 25
>   projectedPaths SetHeightTolerance 5
>   projectedPaths SetProjectionModeToNonOccluded
>   projectedPaths SetProjectionModeToHug
>
>
>
> Are you sure I'm setting it up correctly? I have an empty vtkImageData 
> object. In the books they use a polygonal as the input for the probe, 
> so I'm not clear as how to go about using vtkImageData as a probe.
>
> The vtkProbeFilter::SetSourceConnection is wired to the output of 
> vtkWrapScalar. I guess the vtkWrapScalar at this stage contains the 
> modified scalar data, so it just needs to be copied to the vtkImageData. 
>
>
> Please help!
>
> Best regards,
>
> Elvis Dowson
>
>
>
> On Nov 11, 2008, at 12:19 AM, Amy Squillacote wrote:
>
>> 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
>>
>>
>

-- 
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