Hi Eric,<br><br>Setting a name to the column did the trick! Just calling SetName() on my scalar array seems to have corrected the problem.<br><br>Many thanks!<br><br>Marc<br><br><div class="gmail_quote">On Tue, Jun 21, 2011 at 9:44 AM, Eric E. Monson <span dir="ltr"><<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;">Hey Marc,<div><br></div><div>(Please keep the conversation on the list so everyone can contribute and learn.)</div>
<div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>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</div><div class="im"><div><br></div>
<div>Talk to you later,</div><div>-Eric</div><div><br></div></div><div>===================</div><div>#!/usr/bin/env python<br><br># Testing probe filter with Charts API<br><br>import vtk<br>from vtk.util.misc import vtkGetDataRoot<br>
VTK_DATA_ROOT = vtkGetDataRoot()<br><br># Create a PLOT3D reader and load the data.<br>pl3d = vtk.vtkPLOT3DReader()<br>pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")<br>pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")<br>
pl3d.SetScalarFunctionNumber(100)<br>pl3d.SetVectorFunctionNumber(202)<br>pl3d.Update()<br><br># Create three the line source to use for the probe lines.<br>line = vtk.vtkLineSource()<br>line.SetResolution(30)<br><br># Move the line into place and create the probe filter. For<br>
# vtkProbeFilter, the probe line is the input, and the underlying data<br># set is the source.<br>transL1 = vtk.vtkTransform()<br>transL1.Translate(3.7, 0.0, 28.37)<br>transL1.Scale(5, 5, 5)<br>transL1.RotateY(90)<br>tf = vtk.vtkTransformPolyDataFilter()<br>
tf.SetInputConnection(line.GetOutputPort())<br>tf.SetTransform(transL1)<br>probe = vtk.vtkProbeFilter()<br>probe.SetInputConnection(tf.GetOutputPort())<br>probe.SetSource(pl3d.GetOutput())<br><br># Set up a 2D scene, add an XY chart to it<br>
view = vtk.vtkContextView()<br>view.GetRenderer().SetBackground(1.0, 1.0, 1.0)<br>view.GetRenderWindow().SetSize(400, 300)<br><br>chart = vtk.vtkChartXY()<br>chart.SetShowLegend(True)<br>view.GetScene().AddItem(chart)<br>
<br># Create table of values<br>dot = vtk.vtkDataObjectToTable()<br>dot.SetInputConnection(probe.GetOutputPort(0))<br>dot.SetFieldType(vtk.vtkDataObjectToTable.POINT_DATA)<br>dot.Update()<br><br>dot.GetOutput().Dump(20)<br>
<br># Add a line plot<br>points0 = chart.AddPlot(vtk.vtkChart.LINE)<br>points0.SetInput(dot.GetOutput(), 0, 0)<br>points0.SetUseIndexForXSeries(True)<br>points0.SetColor(0, 0, 0, 255)<br>points0.SetWidth(1.0)<br>points0.SetMarkerStyle(vtk.vtkPlotPoints.CROSS)<br>
<br>view.Render()<br><br># Start interaction event loop<br>view.GetInteractor().Start()<br><br></div><div class="im"><div><img src="cid:4AC0DDD9-5058-4E15-83C5-92236FDDBBBC@trinity.duke.edu" height="148" width="480"></div>
<div><br><div><div>On Jun 21, 2011, at 9:25 AM, Marc Ferland wrote:</div><br><blockquote type="cite">Hi Eric,<br><br><div class="gmail_quote">On Mon, Jun 20, 2011 at 6:23 PM, Eric E. Monson <span dir="ltr"><<a href="mailto:emonson@cs.duke.edu" target="_blank">emonson@cs.duke.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;">Hey Marc,<div><br></div><div>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...?)</div>
</div></blockquote><div><br>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.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;"><div><br></div><div>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.</div>
</div></blockquote><div><br>That would be great Eric. You can send me the Python code and I'll translate it to C++. <br><br>As a side note, I dumped the content of the vtkTable and got this result from my application:<br>
<br>+-----------------+------------------+<br>| | vtkValidPointMas |<br>+-----------------+------------------+<br>| 5544 | |<br>| 646 | |<br>| 358 | |<br>
| 284 | |<br>| 508 | |<br>| 1904 | |<br>+-----------------+------------------+<br><br>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.<br>
<br>Regards,<br>Marc<br></div></div><br>
</blockquote></div><br></div></div></div></blockquote></div><br>