[vtkusers] Extract the Selection in Parallel Coordinates View

田茂春 tian_mao_chun at 126.com
Sat Mar 16 06:22:14 EDT 2013


Hello all,
I am a vtk fresher,I want to extract the Selection in Parallel Coordiantes View.I get the Input data from a txt file(the data like a table),I store the input data in vtkPolyData.I use the vtkExtractSelection to extract,but I get nothing.So I write a simple test,just like the following.
 vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
for(int column=0;column<titles->GetSize();column++)//the titles is an array of columns name.
{
data[column]->SetName(titles->GetValue(column));//data is an array of vtkFloatArray,which store the data from the txt file.
polydata->GetPointData()->AddArray(data[column]);
}
polydata->Update();
vtkSmartPointer<vtkIdTypeArray> ids =
vtkSmartPointer<vtkIdTypeArray>::New();//ids is an array which just store the test selected index.
ids->SetNumberOfComponents(1);
//set values
for(double i = 0; i < 20; i++)
{
ids->InsertNextValue(i);
}

vtkSmartPointer<vtkSelectionNode> selectionNode =
vtkSmartPointer<vtkSelectionNode>::New();
selectionNode->SetFieldType(vtkSelectionNode::POINT);
selectionNode->SetContentType(vtkSelectionNode::INDICES);
selectionNode->SetSelectionList(ids);

vtkSmartPointer<vtkSelection> selection =
vtkSmartPointer<vtkSelection>::New();
selection->AddNode(selectionNode);
vtkSmartPointer<vtkExtractSelection> extractSelection =
vtkExtractSelection::New();
extractSelection->SetInputConnection(0,polydata->GetProducerPort());
extractSelection->SetInput(1,selection);
extractSelection->Update();
//in selection
vtkSmartPointer<vtkUnstructuredGrid> selected =
vtkSmartPointer<vtkUnstructuredGrid>::New();
selected->ShallowCopy(extractSelection->GetOutput());
int numofPoints=selected->GetNumberOfPoints();
I test,the numOfPoints is 0.I dont't know what the problem is,does anyone who can tell me.
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130316/1165bee2/attachment.htm>


More information about the vtkusers mailing list