<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hello all..<div><br></div><div>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?</div><div><div><br></div><div>Here is the sample code that I tried:</div><div><br></div><div>def segmentData(object, event):</div><div> n = object.GetRepresentation().GetNumberOfSeeds()</div><div> </div><div> for i in range(1,n) :</div><div> p = [0.0, 0.0, 0.0]</div><div> object.GetRepresentation().GetSeedDisplayPosition(i-1, p)</div><div> print 'Seed', p[0], p[1], p[2]</div><div><br></div><div>ren = vtk.vtkRenderer()</div><div>renWin = vtk.vtkRenderWindow()</div><div>renWin.AddRenderer(ren)</div><div>iren = vtk.vtkRenderWindowInteractor()</div><div>iren.SetRenderWindow(renWin)</div><div><br></div><div>imageReader = vtk.vtkDICOMImageReader()</div><div>imageReader.SetDirectoryName("C:\\Data")</div><div>imageReader.Update()</div><div><br></div><div>imageViewer = vtk.vtkImageViewer2()</div><div>imageViewer.SetInput(imageReader.GetOutput())</div><div>imageViewer.SetColorLevel(127)</div><div>imageViewer.SetColorWindow(255)</div><div>imageViewer.SetupInteractor(iren)</div><div>imageViewer.GetRenderWindow().SetMultiSamples(0)</div><div>imageViewer.GetRenderWindow().SetSize(500, 500)</div><div>imageViewer.Render()</div><div>imageViewer.GetRenderer().ResetCamera()</div><div>imageViewer.Render()</div><div> </div><div>handle = vtk.vtkPointHandleRepresentation3D()</div><div>handle.AllOn()</div><div>handle.ActiveRepresentationOn()</div><div>handle.GetProperty().SetColor(0,0, 1)</div><div>handle.GetProperty().SetPointSize(5.0)</div><div><br></div><div>pointPlacer = vtk.vtkImageActorPointPlacer()</div><div>pointPlacer.SetImageActor(imageViewer.GetImageActor())</div><div><br></div><div>seedRep = vtk.vtkSeedRepresentation()</div><div>seedRep.SetHandleRepresentation(handle)</div><div><br></div><div>seedWidget = vtk.vtkSeedWidget()</div><div>seedWidget.SetInteractor(iren)</div><div>seedWidget.SetRepresentation(seedRep)</div><div>seedWidget.AddObserver("PlacePointEvent", segmentData)</div><div><br></div><div>seedWidget.SetEnabled(True)</div><div>seedWidget.ProcessEventsOn()</div><div><br></div><div>iren.Initialize()</div><div>ren.ResetCamera()</div><div><br></div><div>iren.Start()</div><div><br></div><div>Thanks ..</div><div><br></div></div> <br /><hr />Hotmail: Powerful Free email with security by Microsoft. <a href='https://signup.live.com/signup.aspx?id=60969' target='_new'>Get it now.</a></body>
</html>