[vtkusers] vtkPolyDataConnectivityFilter to add spatial constraints to KMeans output
Sara Rolfe
smrolfe at u.washington.edu
Mon Jun 11 00:25:10 EDT 2012
Hello,
I am using vtkPolyDataConnectivityFilter to separate spatially
disconnected kmeans regions. The kmeans cluster numbers are in the
"Scalers" array of the polydata. If I understand correctly, my code
should give each of the connected regions sharing a kmeans cluster
number a unique region id. However, my polydata with 95670 points and
7 kmeans clusters produces 39930 connected regions. The kmeans output
does not appear to be noisy, so I don't think this could be right. My
code to set up the filter is is below and I would appreciate any
comments.
Or, is there a better way to accomplish this task?
Thanks for your advice,
Sara
vtkSmartPointer<vtkPolyDataConnectivityFilter> connectivityFilter =
vtkSmartPointer<vtkPolyDataConnectivityFilter>::New();
connectivityFilter->SetInputConnection(labelReader->GetOutputPort());
connectivityFilter->SetExtractionModeToAllRegions();
connectivityFilter->ScalarConnectivityOn();
connectivityFilter->ColorRegionsOn();
connectivityFilter->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120610/6ee6c584/attachment.htm>
More information about the vtkusers
mailing list