[vtkusers] vtkProbeFilter and vtkPlot

Marc Ferland marc.ferland at gmail.com
Mon Jun 20 11:09:02 EDT 2011


Hi,

I'm currently trying to plot the output of a vtkProbeFilter with the new
chart API using a vtkDataObjectToTable filter and I'm having difficulties
getting a vtkTable that will be accepted by the plotter. I get errors like:

ERROR: In /home/marc/tmp/vtk/VTK/Filtering/vtkAlgorithm.cxx, line 460
vtkContextMapper2D (0xd0d630): Attempt to get an input array for an index
that has not been specified

ERROR: In /home/marc/tmp/vtk/VTK/Charts/vtkPlotPoints.cxx, line 600
vtkPlotLine (0xcf9ca0): No Y column is set (index 1).

ERROR: In /home/marc/tmp/vtk/VTK/Filtering/vtkAlgorithm.cxx, line 460
vtkContextMapper2D (0xd0d630): Attempt to get an input array for an index
that has not been specified
....

The code looks like this:
// Convert the polydata to a vtkTable using points data
mPath->toTable = vtkDataObjectToTable::New();
mPath->toTable->SetInputConnection(mProbeFilter->GetOutputPort());
mPath->toTable->SetFieldType(vtkDataObjectToTable::POINT_DATA);
mPath->toTable->Update();

// Test
vtkTable *table = mPath->toTable->GetOutput();
qDebug() << table->GetNumberOfColumns(); // returns 2
qDebug() << table->GetNumberOfRows();    // returns 6
qDebug() << table->GetValue(0, 0).GetTypeAsString(); // returns: "short"
qDebug() << table->GetValue(0, 1).GetTypeAsString(); // returns: "char" <--
weird?!

mPath->view = vtkContextView::New();
mPath->view->GetRenderer()->SetBackground(0.5, 0.5, 0.5);

mPath->chartxy = vtkChartXY::New();
mPath->view->GetScene()->AddItem(mPath->chartxy);
vtkPlot* line = mPath->chartxy->AddPlot(vtkChart::LINE);
line->SetUseIndexForXSeries(true);
line->SetInput(mPath->toTable->GetOutput());
line->SetColor(0.0, 255, 0.0, 255);
line->SetWidth(1.0);

FYI: The old XYPlot actor was working correctly with the same probe filter
input.

So my question is: What am I doing wrong here? Also, is there an example
somewhere showing how to correctly use a vtkProbeFilter and the new charting
API?

Regards,

Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110620/965126c8/attachment.htm>


More information about the vtkusers mailing list