[vtkusers] Access the points of a certain region extracted by vtkPolyDataConnectivityFilter
normanius
juch at zhaw.ch
Mon Feb 22 04:09:08 EST 2016
Hi Cory
Strange, in the web-view of the mailing list, the code is visible.
I repost/rephrase my question, this time without any formatting:
# How I use vtkPolyDataConnectivityFilter:
largest = vtk.vtkPolyDataConnectivityFilter()
largest.SetInputConnection(input.GetOutputPort())
largest.SetExtractionModeToLargestRegion()
largest.Update()
# How I would like to extract the points from the largest region,
# but this does not work: It gives me all the points of input
polyData = largest.GetOutput()
N = polyData.GetNumberOfPoints()
for i in range(0, N):
p = sourceData.GetPoint(i)
# What I currently do to extract those points:
lines = largest.GetOutput().GetLines() # cell array
lines.InitTraversal()
idList = vtk.vtkIdList()
I = set()
while lines.GetNextCell(idList):
for i in range(0, idList.GetNumberOfIds()):
index = idList.GetId(i)
if index not in I:
p = sourceData.GetPoint(index)
I.add(index)
# Is there a more direct way of extracting only the connected region
# of interest?
--
View this message in context: http://vtk.1045678.n5.nabble.com/Access-the-points-of-a-certain-region-extracted-by-vtkPolyDataConnectivityFilter-tp5736688p5736694.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list