[vtkusers] vtkImageViewer2 picking

vidyadhar vidyadhar at lucidindia.net
Mon May 2 23:05:01 EDT 2005


Hi,
imageViewer2.GetRenderer().GetActors() will get vtkActorCollection of
renderer. vtkImageViewer2 does not create any vtkActors. It creates
vtkImageActor which can be accessed using GetImageActor method of that
class. You will need to get this reference and use AddPickList of picker to
add it to pick list.
HTH
Vidyadhar
----- Original Message -----
From: "nikolaus heger" <nikolaus.heger at gmail.com>
To: "Mark Wyszomierski" <markww at gmail.com>
Cc: "vtkusers" <vtkusers at vtk.org>
Sent: Monday, May 02, 2005 2:54 PM
Subject: Re: [vtkusers] vtkImageViewer2 picking


> 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