Add custom interaction with sliceview


There are two ways to zoom slice view:

  1. hold right mouse btn adn drag
  2. hold ctrl key and use wheel

I’m going to implement the interaction that changes FOV independently by vertical and horizontal dimensions when user holds ctrl and drag mouse with right button mouse pressed.

Is there a way to do that inside custom displayable manager or do I have to modify vtkMRMLSliceViewInteractorStyle?

This can be done with custom displayable manager’s methods:

  virtual bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double &closestDistance2) override;
  virtual bool ProcessInteractionEvent(vtkMRMLInteractionEventData* eventData) override;

eventData contains all the necessary information about hotkeys and mouse pisition.

And sliceview zooming implementation example can be found in vtkMRMLSliceIntersectionWidget::ProcessZoomSlice