[vtkusers] Probing problem

Roger Blum rogerblum at hawaii.rr.com
Mon Apr 14 19:55:58 EDT 2008


Hello,

I am trying to extract an elevation profile from a vtkPolyData object.
The elevation data is given by a triangular mesh of points.
When visualized with a vtkPolyDataMapper and an actor it looks as expected.

I now would like to extract an elevation profile along an arbitrary 
line. For this purpose I create a vtkLineSource defined by 2 points.
I then probe the data (the vtkPolyData object) along this line with the 
vtkProbeFilter (line is input, data set is source).

The resulting output is then added as input to a vtkXYPlotActor.

At runtime my tcl test script (snippet of relevant parts below) reports
PF num Points: 283
ERROR: In ./VTK/Hybrid/vtkXYPlotActor.cxx, line 1084
vtkXYPlotActor (0x8461560): No scalar data to plot!

My questions:
- Is the chosen approach correct to extract the desired information?
- Should I probe with a plane (tried without success, more points but
   same error message)?
- What am I missing?
- Why are there no scalar values generated?

---- snip ----
# Create the reader for the data
vtkXMLPolyDataReader reader
reader SetFileName "../../maps/dhm/dhm43.vtp"
reader Update
puts "Reader Num points: [reader GetNumberOfPoints]"; # 75831 points

# Visualize input data
vtkPolyDataMapper mapper
mapper SetInput [reader GetOutput]
vtkActor actor
actor SetMapper mapper

# Create probe source in range of given data set
set x1 715000
set y1 125000
set x2 720000
set y2 130000
set dist [expr {sqrt (pow($x1 - $x2, 2) + pow($y1 - $y2, 2))}]
vtkLineSource LS
LS SetPoint1 $x1 $y1 0
LS SetPoint2 $x2 $y2 0
LS SetResolution [expr {int($dist / 25)}]; # Probe every 25m

# Create probe filter
vtkProbeFilter PF
PF SetInput  [LS GetOutput]
PF SetSource [reader GetOutput]
PF Modified
PF Update
puts "PF num Points: [[PF GetOutput] GetNumberOfPoints]"

# Create XY plot actor
vtkXYPlotActor XYPA
XYPA SetXValuesToValue
XYPA SetDataObjectPlotModeToRows
XYPA AddInput [PF GetOutput]
XYPA SetLabelFormat "%#6.0f"
XYPA SetNumberOfXLabels 5
XYPA SetNumberOfYLabels 5
XYPA LegendOff
XYPA PlotLinesOn
XYPA SetDisplayPosition 0 0
XYPA SetPosition2 1 1
XYPA SetYTitle "Elevation"
---- snip ----


Thanks for any hint,
Roger





More information about the vtkusers mailing list