How to get the gray value of vtkImageSlice through the point moved by the mouse
There are several steps involved with this.
- Given a mouse display position (x,y), convert that to a world location.
- Project that world location onto the plane defined by the vtkImageSlice position and normal
- With the projected world location, use
imageData.worldToIndex
to get an image index - Read the scalar from the image data based on the image index you got from step 3
Hello, I encountered difficulties in the first step, how to convert a mouse display position (x,y) to a world location? I found the getPickPosition method in vtkPointPicker, thinking that there is a conversion method, but I did not find the implementation of the getPickPosition method. There is a second step, how to project the world location to vtkImageSlice? There is no idea of implementation. Can you provide some examples of concrete implementations
You would want to look at openglRenderWindow.displayToWorld(x, y, z, renderer)
.