[vtkusers] vtkImagePlaneWidget UserMatrix?

Marc Mörig marc.moerig at dornheim-medical-images.de
Fri Apr 12 08:03:51 EDT 2013



On 04/10/2013 11:32 PM, John McManigle wrote:
>
> What I've tried, with partial success, is to modify
> vtkImagePlaneWidget to add a "SetUserMatrix" function that calls
> SetUserMatrix on its actor members.  This results in proper display of
> the three planes, but mouse inputs are (predictably) not transformed
> accordingly, so the resulting system is pretty hard to work with.  Is
> there a way to similarly transform mouse input?

Hi John,

you probably did not notice that i asked the same question just a few 
hours earlier. You can indeed fix the interactions in a similar manner.

Interactions are performed by methods Rotate,Scale,Spin,Push,Translate 
which get as input two points and in one case an additional vector. You 
need to apply the inverse transformtation to these inputs prior to 
calling these functions.

Then there is AdjustState, which performs a kind of picking on the plane 
to decide which of the interactions to perform. AdjustState depends on 
LastPickPosition, so you need to apply the inverse transformation to 
that point, too. You should not forget to restore it afterwards.

I have achieved this by subclassing from vtkImagePlaneWidget and 
reimplementing the virtual functions OnMouseMove and StartSliceMotion.

Hope this helps. I would also like to know if i have missed some places 
that need to be changed.

Marc



More information about the vtkusers mailing list