[vtkusers] vtkProbeFilter and vtkPlot

Eric E. Monson emonson at cs.duke.edu
Tue Jun 21 09:44:23 EDT 2011


Hey Marc,

(Please keep the conversation on the list so everyone can contribute and learn.)

Re: your second column – When I dump my table, the vtkValidPointMask also doesn't print out. It looks like it's basically supposed to be a boolean array showing which points are valid, or something, but they're using a vtkCharArray to store the MaskPoints in vtkProbeFilter.

I don't know if this is creating any problems, but you may want to make sure the scalar attribute that's being probed in your original data is a named array. It's a little strange that the first column of your table doesn't have a header (name), and I don't know offhand if unnamed table columns could be causing problems in the charts.

I'll append my Python test at the end of my email. It's just a hacked-together combo of a line chart test and a piece of Examples/Annotation/Python/xyPlot.py

Talk to you later,
-Eric

===================
#!/usr/bin/env python

# Testing probe filter with Charts API

import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

# Create a PLOT3D reader and load the data.
pl3d = vtk.vtkPLOT3DReader()
pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
pl3d.SetScalarFunctionNumber(100)
pl3d.SetVectorFunctionNumber(202)
pl3d.Update()

# Create three the line source to use for the probe lines.
line = vtk.vtkLineSource()
line.SetResolution(30)

# Move the line into place and create the probe filter.  For
# vtkProbeFilter, the probe line is the input, and the underlying data
# set is the source.
transL1 = vtk.vtkTransform()
transL1.Translate(3.7, 0.0, 28.37)
transL1.Scale(5, 5, 5)
transL1.RotateY(90)
tf = vtk.vtkTransformPolyDataFilter()
tf.SetInputConnection(line.GetOutputPort())
tf.SetTransform(transL1)
probe = vtk.vtkProbeFilter()
probe.SetInputConnection(tf.GetOutputPort())
probe.SetSource(pl3d.GetOutput())

# Set up a 2D scene, add an XY chart to it
view = vtk.vtkContextView()
view.GetRenderer().SetBackground(1.0, 1.0, 1.0)
view.GetRenderWindow().SetSize(400, 300)

chart = vtk.vtkChartXY()
chart.SetShowLegend(True)
view.GetScene().AddItem(chart)

# Create table of values
dot = vtk.vtkDataObjectToTable()
dot.SetInputConnection(probe.GetOutputPort(0))
dot.SetFieldType(vtk.vtkDataObjectToTable.POINT_DATA)
dot.Update()

dot.GetOutput().Dump(20)

# Add a line plot
points0 = chart.AddPlot(vtk.vtkChart.LINE)
points0.SetInput(dot.GetOutput(), 0, 0)
points0.SetUseIndexForXSeries(True)
points0.SetColor(0, 0, 0, 255)
points0.SetWidth(1.0)
points0.SetMarkerStyle(vtk.vtkPlotPoints.CROSS)

view.Render()

# Start interaction event loop
view.GetInteractor().Start()



On Jun 21, 2011, at 9:25 AM, Marc Ferland wrote:

> Hi Eric,
> 
> On Mon, Jun 20, 2011 at 6:23 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hey Marc,
> 
> I'm not sure, offhand, what is going on. Just in case it's relevant, what version of VTK are you using, and on what platform? Are you able to run other tests and examples that use the Charts API? (Charts has changed a lot between 5.6 and the development head, and maybe it's not tested well on your system...?)
> 
> I'm using VTK from the git repo (my copy is dated June 20th). I'm running on Ubuntu Linux. I tested some chart examples and they work well on my system.
>  
> 
> Before my original reply I tried a combination of a probe filter, data object to table and vtkChart in Python and it worked okay. I can pass that along to you tomorrow, or I can try to do a quick translation into C++ if you need it. That at least might test some specific pieces on your system that work on mine.
> 
> That would be great Eric. You can send me the Python code and I'll translate it to C++. 
> 
> As a side note, I dumped the content of the vtkTable and got this result from my application:
> 
> +-----------------+------------------+
> |                 | vtkValidPointMas |
> +-----------------+------------------+
> | 5544            |                 |
> | 646             |                 |
> | 358             |                 |
> | 284             |                 |
> | 508             |                 |
> | 1904            |                 |
> +-----------------+------------------+
> 
> The first column is the scalar data and it seems ok, but the second column is what's really puzzling me. It looks like an internal data format... The vtkTable says it's a 'char' and it appears as non-printable characters in my console.
> 
> Regards,
> Marc
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110621/8ef50ad7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProbeChart.png
Type: image/png
Size: 40497 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110621/8ef50ad7/attachment.png>


More information about the vtkusers mailing list