mouse coordinates from a 3d volume with wrong y

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

mouse coordinates from a 3d volume with wrong y

zandarina
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)

thanks


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

            vtkSmartPointer<vtkCellPicker> picker =
                vtkSmartPointer<vtkCellPicker>::New();
            picker->SetTolerance(0.0005);


            //this->GetDefaultRenderer()->Clear();

            // 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;
            }

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: mouse coordinates from a 3d volume with wrong y

Andras Lasso

Would you mind posting your question to https://discourse.vtk.org? Community support for VTK is transitioning to that forum, and you are more likely to get an answer there.

 

Thanks,

Andras

 

 

From: vtkusers <[hidden email]> On Behalf Of Esmeralda Ruiz
Sent: Wednesday, March 20, 2019 8:55 AM
To: [hidden email]
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)

 

thanks

 

 

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

            vtkSmartPointer<vtkCellPicker> picker =
                vtkSmartPointer<vtkCellPicker>::New();
            picker->SetTolerance(0.0005);


            //this->GetDefaultRenderer()->Clear();

            // 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;
            }


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers