[vtkusers] picking in a view of a vtkImagePlaneWidget

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Apr 4 12:28:05 EST 2003


I have an vtkImageActor that is the output of a vtkImagePlaneWidget

    colorMap = vtk.vtkImageMapToColors()
       ... some color map commands ...
    colorMap.SetLookupTable(planeWidget.GetLookupTable())
    imageActor = vtk.vtkImageActor()
    colorMap.SetInput(planeWidget.GetResliceOutput())
    imageActor.SetInput(colorMap.GetOutput())

I am rendering this imageActor in a different render window from the
one the plane widget is in.  The plane widgets may not be orthogonal
to the major axes.  I want to pick a point in the imageActor render
window, and get the world coordinates of the point in the image data
under the pointer.  I am wondering if I can do this with a picker.

I tried vtkPropPicker, but this always returned the imageActor, not
the coordinates of the imageActor under the point.

I tried vtkPointPicker, 

    picker = vtk.vtkPointPicker()             
    b = picker.Pick(xp, yp, 0.0, renderer)
    if b: 
      id = picker.GetPointId()

but this always failed (b=FALSE) even when my pointer was clearly over
the imageActor.  Ditto for vtkCellPicker.

Can this be done with a picker, or do I need to compute the world
point by doing the transformations from viewport coords myself?

Thanks,
John Hunter



More information about the vtkusers mailing list