[vtkusers] vtkPolyDataConnectivityFilter and world position of the vtkActors
Mark K. Batesole, DDS, MS
mbatesole at yahoo.com
Wed Jun 23 18:26:29 EDT 2010
Hi Everyone,
I'm having a heck of a time getting this little application to work correctly. Here's the problem I'm having: after splitting the polydata and assigning each part an actor. I'd like to get the world position of each actor so that I can then run an vtkIterativeClosestPointTransform and know what the transformation matrix is from one of the actors to another. So I've used vtkActor->GetPosition() which according to all the documentation I've found should return the actor's world coordinates. But each actor returns (0.0, 0.0, 0.0). Since they are not all on top of each other at the origin, I don't see how this could be correct.
I know I must be missing something... any help would be sincerely appreciated.
Thank you,
Mark
<code snippet follows>
def splitParts(polydata):
conn = vtk.vtkPolyDataConnectivityFilter()
conn.SetInput(polydata)
conn.SetExtractionModeToAllRegions()
conn.Update()
nregions = conn.GetNumberOfExtractedRegions()
conn.SetExtractionModeToSpecifiedRegions()
conn.Update()
polydata_collection = []
for region in xrange(nregions):
conn.InitializeSpecifiedRegionList()
conn.AddSpecifiedRegion(region)
conn.Update()
p = vtk.vtkPolyData()
p.DeepCopy(conn.GetOutput())
p.Update()
polydata_collection.append(p)
return polydata_collection
reader = vtk.vtkXMLPolyDataReader()
reader.SetFileName('Model.vtp')
reader.Update();
polydataCollection = splitParts(reader.GetOutput())
actorCollection = []
for item in xrange(len(polydataCollection)):
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(polydataCollection[item])
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actorCollection.append(actor)
ren.AddActor(actor)
print actor.GetPosition()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100623/aff9341f/attachment.htm>
More information about the vtkusers
mailing list