[vtkusers] vtkSeedWidget and vtkImageActorPointPlacer

Subashini S subashini7 at hotmail.com
Mon Feb 15 10:46:01 EST 2010


Hello all..
I am trying to use vtkSeedWidget with vtkImageActorPointPlacer. But even with this point placer I am able to set the seed points outside the image. Is it possible to restrict the seed points placement to be over the image alone, similar to the contour widget? and how is it possible to get the image coordinates/pixel of the seed point?
Here is the sample code that I tried:
def segmentData(object, event):    n = object.GetRepresentation().GetNumberOfSeeds()        for i in range(1,n) :        p = [0.0, 0.0, 0.0]        object.GetRepresentation().GetSeedDisplayPosition(i-1, p)        print 'Seed', p[0], p[1], p[2]
ren = vtk.vtkRenderer()renWin = vtk.vtkRenderWindow()renWin.AddRenderer(ren)iren = vtk.vtkRenderWindowInteractor()iren.SetRenderWindow(renWin)
imageReader = vtk.vtkDICOMImageReader()imageReader.SetDirectoryName("C:\\Data")imageReader.Update()
imageViewer = vtk.vtkImageViewer2()imageViewer.SetInput(imageReader.GetOutput())imageViewer.SetColorLevel(127)imageViewer.SetColorWindow(255)imageViewer.SetupInteractor(iren)imageViewer.GetRenderWindow().SetMultiSamples(0)imageViewer.GetRenderWindow().SetSize(500, 500)imageViewer.Render()imageViewer.GetRenderer().ResetCamera()imageViewer.Render()    handle = vtk.vtkPointHandleRepresentation3D()handle.AllOn()handle.ActiveRepresentationOn()handle.GetProperty().SetColor(0,0, 1)handle.GetProperty().SetPointSize(5.0)
pointPlacer = vtk.vtkImageActorPointPlacer()pointPlacer.SetImageActor(imageViewer.GetImageActor())
seedRep = vtk.vtkSeedRepresentation()seedRep.SetHandleRepresentation(handle)
seedWidget = vtk.vtkSeedWidget()seedWidget.SetInteractor(iren)seedWidget.SetRepresentation(seedRep)seedWidget.AddObserver("PlacePointEvent", segmentData)
seedWidget.SetEnabled(True)seedWidget.ProcessEventsOn()
iren.Initialize()ren.ResetCamera()
iren.Start()
Thanks ..
 		 	   		  
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100215/103674d2/attachment.htm>


More information about the vtkusers mailing list