[vtkusers] mouse coordinates from a 3d volume with wrong y

Andras Lasso lasso at queensu.ca
Wed Mar 20 09:25:15 EDT 2019

Would you mind posting your question to https://discourse.vtk.org<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdiscourse.vtk.org&data=02%7C01%7Classo%40queensu.ca%7C5304536c0989415fbbc908d6ac81b86e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636886070474774650&sdata=lun%2BrDG1HY0uvG2whuSD8ErGkAwmr0Vl2a7iBriy%2BdQ%3D&reserved=0>? Community support for VTK is transitioning to that forum, and you are more likely to get an answer there.


From: vtkusers <vtkusers-bounces at vtk.org> On Behalf Of Esmeralda Ruiz
Sent: Wednesday, March 20, 2019 8:55 AM
To: vtkusers at vtk.org
Subject: [vtkusers] mouse coordinates from a 3d volume with wrong y

Dear all,
I want to get the positions of a volume using the mouse for segmentation.  But the y coordinate is wrong. I only get the x and z fine but the depth (y) is not correct. I use this code to get the position. Is there any way to obtain the slice (y position)


            // Get the location of the click (in window coordinates)
            int* pos = this->GetInteractor()->GetEventPosition();

            vtkSmartPointer<vtkCellPicker> picker =


            // Pick from this location.
            picker->Pick(pos[0], pos[1], 0, global_renderer);

            double* worldPosition = picker->GetPickPosition();
            std::cout << "Cell id is: " << picker->GetCellId() << std::endl;

            if (picker->GetCellId() != -1)

                std::cout << "Pick position is: " << worldPosition[0] << " " << worldPosition[1]
                    << " " << worldPosition[2] << endl;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190320/ecb1ea9c/attachment.html>

More information about the vtkusers mailing list