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). I only consider vtk (so i do not need the flipping in y). It is interesting that some areas are working more o less. But others the depth is very different. I only have one object.

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;
        }
1 Like

I realized that there is skin with less opacity and this is why the y is wrong. How can i go through the skin and get the position behind.

Thanks

1 Like