[vtkusers] mouse coordinates from a 3d volume with wrong y
esmeralda.ruiz at alma3d.com
Wed Mar 20 08:55:19 EDT 2019
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, pos, 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 << "
" << worldPosition
<< " " << worldPosition << endl;
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers