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

Luis Roberto P. Paula luisrpp at gmail.com
Mon Nov 10 12:00:31 EST 2008


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!!
}

thanks,
Luis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081110/9c1bff60/attachment.htm>


More information about the vtkusers mailing list