[vtkusers] Extract Polydata points with same scalar value
Sara Rolfe
smrolfe at u.washington.edu
Mon Jun 25 18:43:40 EDT 2012
Hello,
I am attempting to extract points with the same data value from the
output of a K-Means segmentation. First I copied the labels into the
polydata's scalar array. Then I used vtkClipPolyData to select points
with one label at a time. (My goal is to input these to
vtkPolyDataConnectivity to seperate spatially disconnected clusters).
I set up the clipping filters as follows:
for (int i = 0; i < inRange[1]+1; i++)
{
vtkSmartPointer<vtkClipPolyData> clippersTestLo =
vtkSmartPointer<vtkClipPolyData>::New();
clippersTestLo->SetValue(i);
clippersTestLo->SetInput(contourPolydata);
clippersTestLo->InsideOutOn();
clippersTestLo->Update();
vtkSmartPointer<vtkClipPolyData> clippersTestHi =
vtkSmartPointer<vtkClipPolyData>::New();
clippersTestHi->SetValue(i-1);
clippersTestHi->SetInputConnection(clippersTestLo->GetOutputPort());
clippersTestHi->InsideOutOff();
clippersTestHi->Update();
cout << "Number of points with label " << i << ": " << clippersTestHi-
>GetOutput()->GetNumberOfPoints() << endl;
}
This output number of points is incorrect but close to the right
number, for example, 19770 points with label 0 instead of the actual
19783. I'd appreciate any ideas on where this error is coming from.
Or is there a better solution for extracting these points so I can
input them into vtkPolyDataConnectivity?
Thanks,
Sara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120625/7b3707ee/attachment.htm>
More information about the vtkusers
mailing list