help on how to get the pixel position.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

help on how to get the pixel position.

Dongqing Chen
Dear All:
 
  I am not very familar with VTK Programming. Now I want to get the position of any pixel on which I click using mouse. I think that it should just be some built-in commands? anyone helps me? thanks a lot.
 
Best Wishes,
 
Dongqing Chen
Rm. 007, Paul C. Lutz Hall
Computer Vision & Image Processing (CVIP) Lab
Dept. of Electrical & Computer Engineering
University of Louisville
Louisville, KY. 40292
Email: [hidden email]
Phone: (502)852-6130(Office)
            (502)852-2789(Lab)

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: help on how to get the pixel position.

Darshan Pai
GetSelectionPoint()

dqchen <[hidden email]> wrote:
Dear All:
 
  I am not very familar with VTK Programming. Now I want to get the position of any pixel on which I click using mouse. I think that it should just be some built-in commands? anyone helps me? thanks a lot.
 
Best Wishes,
 
Dongqing Chen
Rm. 007, Paul C. Lutz Hall
Computer Vision & Image Processing (CVIP) Lab
Dept. of Electrical & Computer Engineering
University of Louisville
Louisville, KY. 40292
Email: [hidden email]
Phone: (502)852-6130(Office)
            (502)852-2789(Lab)
_______________________________________________
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


Yahoo! Photos
Got holiday prints? See all the ways to get quality prints in your hands ASAP.
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: help on how to get the pixel position.

Obada Mahdi
In reply to this post by Dongqing Chen
Hi Dongquing,

I am not sure what exactly you are looking for, so I am just going to
blurt out whatever I know about "pickers" in vtk.
@all: Please correct me if I am providing erroneous information.

On Tue, 17 Jan 2006, dqchen wrote:
>   I am not very familar with VTK Programming. Now I want to get the
>   position of any pixel on which I click using mouse. I think that it
>   should just be some built-in commands?

If I got your question right, you want to determine world coordinates of
a spot pointed to by the mouse.  Retrieving such information from a
rendered scene in VTK is done by a "picker".  There are several types of
pickers available in VTK; which one to choose depends on what has to be
picked.  For example, there are

- vtkWorldPointPicker
  Determines (x, y, z) coordinates in world space.  This picker uses
  hardware acceleration on most (?) systems, exploiting depth buffer
  information.
    This is most probably what you want.  However, there is no control
  over which objects are included in the picking process and which are
  not; e.g., if for some reason you have a translucent object in a scene
  and need to pick "through" it (like the patient's skin in a 3D
  reconstruction of medical image data), you would have to use a
  software picker like the one below.
- vtkCellPicker
  Also determines cell IDs.  This picker sends a ray from the camera
  position through a point on the viewport, given by display
  coordinates, and intersects this ray with geometry in the scene.  Like
  its superclass, vtkPicker, the vtkCellPicker actually determines a
  list of geometric objects which intersect with the ray (or are close
  enough, see the SetTolerance() method).  The GetCellId() method just
  returns the ID of the intersected cell of the closest actor.
    Note that vtkPicker and its subclasses only consider for
  intersection the geometry of actors that have been marked "pickable",
  which is not the default; see the SetPickable(int) method of vtkProp
  and descendants.
    Note also that this picker can be quite slow, especially if complex
  geometry is involved.

You would use a picker like this:
1. Get mouse coordinates using the API that connects to your windowing
   system.
2. Maybe adjust the tolerance for vtkPicker-compatible pickers.
3. Call the picker's Pick(x, y, z, renderer) method , with "x" and "y"
   being the mouse coordinates relative to the render window, "z"
   usually set to 0 and "renderer" being the corresponding renderer.

Example:
{
        vtkWorldPointPicker* picker = vtkWorldPointPicker::New();
        double pickCoords[3];

        ...
        picker->Pick(mouseX, mouseY, 0.0, myRenderer);
        picker->GetPickPosition(pickCoords);
        ...
}

You might want to refer to the class documentation for a more detailed
description of available methods at
http://www.vtk.org/doc/nightly/html/classvtkAbstractPropPicker.html
and related pages.


Regards

Obada
_______________________________________________
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
Loading...