[vtkusers] VTK picking pixel

Fabian Torres dae.wong at gmail.com
Mon May 4 20:43:49 EDT 2015


Hi all.

I been having some problems using the vtkPicker class.

I want to know the pixel coordinates when the mouse passes throught the
image. I'm displaying the image in a vtkImageViewer2 using QT.
When I open the image, the picker seems to pick the right pixel, the
problem comes when I change the size of the QT window the picker stops
working properly, only in a small region of the image it seems that the
picker choose the right pixel, in other regions of the image it doesn't
change or only changes one pixel although the mouse moves a lot more.

A simplification of the code I'm using is this

vtkSmartPointer<vtkPropPicker> propPicker =
vtkSmartPointer<vtkPropPicker>::New();
    propPicker->PickFromListOn();

propPicker->AddPickList(imageActor);

vtkSmartPointer<vtkRenderWindowInteractor> interactor =
          Viewer->GetRenderWindow()->GetInteractor();


int* windowPosition = interactor->GetEventPosition();

int xWindow = windowPosition[0];
int yWindow = windowPosition[1];
int zWindow = windowPosition[2];

this->Picker->Pick(xWindow, yWindow, zWindow, Viewer->GetRenderer());

double* imPos = this->Picker->GetPickPosition();

xImagePosition = vtkMath::Round(imPos[0]);
yImagePosition = vtkMath::Round(imPos[1]);



-- 
Fabián Torres Robles
Maestria en Ciencias en Ingeniería Electrónica
Ingeniería en Sistemas Electrónicos
tel. 58081280, 0445534661338
e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150504/dd53abef/attachment.html>


More information about the vtkusers mailing list