[vtkusers] Getting the pixel value and coords of a 2D image

clinton at elemtech.com clinton at elemtech.com
Mon Nov 10 12:05:48 EST 2008


On Monday 10 November 2008 10:00:31 am Luis Roberto P. Paula wrote:
> Hi All,
>
> How can I get the pixel value and the coords of an image being displayed in
> a QVTKWidget using the mouse move event? It is a 2D image.
>
> I'm trying to use the vtkPointPicker, as presented below, but I'm getting a
> segmentation fault and I don't know why.
>
>    ...
>    connections = vtkEventQtSlotConnect::New();
>    connections->Connect(vtkWidget->GetRenderWindow()->GetInteractor(),
>                         vtkCommand::MouseMoveEvent,
>                         this,
>                         SLOT(updateCoords(vtkObject*)));
> }
>
> void MyClass::updateCoords(vtkObject* obj)
> {
>    vtkRenderWindowInteractor* iren =
> vtkRenderWindowInteractor::SafeDownCast(obj);
>
>    vtkPointPicker* pointPicker =
> vtkPointPicker::SafeDownCast(iren->GetPicker());
>    pointPicker->PrintSelf(cerr,vtkIndent()); // seg. fault here!!
> }
>

Are you sure its a vtkPointPicker?  VTK creats a vtkPropPicker by default.
Did you set up your own vtkPointPicker?

Clint



More information about the vtkusers mailing list