[vtkusers] vtkPicker returned actor

David Gobbi david.gobbi at gmail.com
Mon Feb 29 18:19:07 EST 2016


Hi Lonni,

Regarding picker->PickTextureOn(), I looked through the code and the
docs, and it only moves the results of GetPointIJK(), GetCellIJK(), and
GetPCoords() into the vtkTexture input data space.  GetMapperPoint() still
returns the coord in the vtkPolyDataMapper input space.

So to get the data coords in the texture's data space, you'd have to do
something like this pseudocode:

ix, iy, iz = picker->GetCellIJK()
px, py, pz = picker->GetPCoords()
x = origin[0] + (ix + px - 0.5)*spacing[0]
y = origin[1] + (iy + py - 0.5)*spacing[1]
z = origin[2] + (iz + pz - 0.5)*spacing[2]

The above should give accurate data coords within the image space of
the vtkTexture's input.


Moving on to your latest email:

If you are getting the position with picker->GetMapperPosition(), and if I
understand your pipeline properly, then the only matrix you need to apply
to that position is the ResliceAxes matrix.  If that's not working, then
maybe
I still don't completely understand your pipeline (but I'm getting
exhausted).

If you were getting the position in world coordinates, with
GetPickPosition(),
then you would have to apply the inverse of the actor matrix to move from
world coordinates to data coordinates.  But rather than use
GetPickPosition(),
I believe it is better to instead get the data coords as I outlined above.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160229/dec57647/attachment.html>


More information about the vtkusers mailing list