[vtkusers] vtkImageViewer2 picking

nikolaus heger nikolaus.heger at gmail.com
Mon May 2 05:24:40 EDT 2005


How do i pick points on a vtkImageViewer2?

I added a vtkPointPicker, but with no success. It never picks anything. So far, 
the problem seems to be that there are no actors in the renderer...

# this code snippet (Python):
         self.imageViewer2 = vtk.vtkImageViewer2()
         self.imageViewer2.SetInput(reader.GetOutput())
         print "DEBUG ", self.imageViewer2.GetRenderer().GetActors()

prints out this:
DEBUG  vtkActorCollection (068C55A0)
   Debug: Off
   Modified Time: 894
   Reference Count: 3
   Registered Events: (none)
   Number Of Items: 0

I don't understand why there are 0 actors, but it would certainly explain that 
the picker doesn't pick anything. I also check the same thing further down the 
road, e.g. after rendering. Always the same problem: The renderer contains no 
actors.
At the same time, the image seems to render just fine, and i can zoom and pan!

Please help if you have any ideas! Thanks!

	Nik

Mark Wyszomierski wrote:
> Hi,
> 
> I am displaying a 2D image using vtkImageViewer2. I want to set a
> pixel that the user clicks on to a certain color. What function can I
> use to get the coordinates of the pixel the user clicked on.
> 
> Secondly, after I know the coordinates, should I just set the voxel in
> the underlying volume to my color, then call viewer2->Render() to
> update the image. I am trying to implement some fast drawing and am
> worried that calling Render() after each time I set a voxel color may
> be too slow? Thanks for any ideas.
> 
> Mark
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 




More information about the vtkusers mailing list