Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkDisplayActionEventBroadcast.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkDisplayActionEventBroadcast_h
14 #define mitkDisplayActionEventBroadcast_h
15 
17 #include <MitkCoreExports.h>
18 
19 namespace mitk
20 {
38  {
39  public:
41  itkFactorylessNewMacro(Self);
42  itkCloneMacro(Self);
43 
55  void Notify(InteractionEvent* interactionEvent, bool isHandled) override;
56 
57  protected:
58 
63 
67  void ConnectActionsAndFunctions() override;
68 
75  void ConfigurationChanged() override;
76 
84  bool FilterEvents(InteractionEvent* interactionEvent, DataNode* dataNode) override;
85 
87  // Functions to react to interaction events (actions)
89 
95  bool CheckPositionEvent(const InteractionEvent* interactionEvent);
96 
102  bool CheckRotationPossible(const InteractionEvent* interactionEvent);
103 
109  bool CheckSwivelPossible(const InteractionEvent* interactionEvent);
110 
112  void Init(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
113 
115  void Move(StateMachineAction* stateMachineAction , InteractionEvent* interactionEvent);
116 
118  void SetCrosshair(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
119 
121  void Zoom(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
122 
124  void Scroll(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
125 
127  void ScrollOneUp(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
128 
130  void ScrollOneDown(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
131 
133  void AdjustLevelWindow(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
134 
136  void StartRotation(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
137 
139  void EndRotation(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
140 
142  void Rotate(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
143 
145  void Swivel(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
146 
148  void IncreaseTimeStep(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
149 
151  void DecreaseTimeStep(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent);
152 
153  private:
154 
159  bool GetBoolProperty(PropertyList::Pointer propertyList, const char* propertyName, bool defaultValue);
160 
163 
165  bool m_AlwaysReact;
166 
168  Point2D m_StartCoordinateInMM;
170  Point2D m_LastDisplayCoordinate;
172  Point2D m_CurrentDisplayCoordinate;
173 
175  bool m_AutoRepeat;
176 
183  int m_IndexToSliceModifier;
184 
186  std::string m_ScrollDirection;
188  bool m_InvertScrollDirection;
190  std::string m_ZoomDirection;
192  bool m_InvertZoomDirection;
194  float m_ZoomFactor;
196  bool m_InvertMoveDirection;
198  std::string m_LevelDirection;
200  bool m_InvertLevelWindowDirection;
202  bool m_LinkPlanes;
203 
204  typedef std::vector<SliceNavigationController*> SNCVector;
205  SNCVector m_RotatableSNCs;
206  SNCVector m_SNCsToBeRotated;
207 
208  Point3D m_LastCursorPosition;
209  Point3D m_CenterOfRotation;
210 
211  Point2D m_ReferenceCursor;
212 
213  Vector3D m_RotationPlaneNormal;
214  Vector3D m_RotationPlaneXVector;
215  Vector3D m_RotationPlaneYVector;
216 
217  Vector3D m_PreviousRotationAxis;
218  ScalarType m_PreviousRotationAngle;
219  };
220 } // end namespace
221 
222 #endif
#define MITKCORE_EXPORT
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Event state machine that observes interaction events and broadcasts display action events.
void ConfigurationChanged() override
Called when the event configuration is set or changed.
void AdjustLevelWindow(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Broadcast a DisplaySetLevelWindowEvent based on mouse movement.
void Move(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Broadcast a DisplayMoveEvent based on mouse movement.
void ScrollOneDown(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Broadcast a DisplayScrollEvent to scroll one slice down.
void ScrollOneUp(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Broadcast a DisplayScrollEvent to scroll one slice up.
mitkClassMacro(DisplayActionEventBroadcast, EventStateMachine)
bool CheckSwivelPossible(const InteractionEvent *interactionEvent)
Check if swivel is possible given the current interaction state.
void EndRotation(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
End a plane rotation interaction.
void Scroll(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Broadcast a DisplayScrollEvent based on mouse movement.
void Zoom(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Broadcast a DisplayZoomEvent based on mouse movement.
bool CheckPositionEvent(const InteractionEvent *interactionEvent)
Check if the given event is an InteractionPositionEvent.
void StartRotation(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Begin a plane rotation interaction.
void IncreaseTimeStep(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Increase the current time step by one.
~DisplayActionEventBroadcast() override
Destructor. Unregisters the MicroService.
void SetCrosshair(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Broadcast a DisplaySetCrosshairEvent at the current position.
bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode) override
Filter events by checking the sender renderer.
void Swivel(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Perform a plane swivel based on mouse movement.
void DecreaseTimeStep(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Decrease the current time step by one.
void ConnectActionsAndFunctions() override
Connect the action names from the state machine XML with member functions.
void Notify(InteractionEvent *interactionEvent, bool isHandled) override
Called for every InteractionEvent observed through the InteractionEventObserver interface.
DisplayActionEventBroadcast()
Constructor. Connects actions and registers as a MicroService.
bool CheckRotationPossible(const InteractionEvent *interactionEvent)
Check if rotation is possible given the current interaction state.
void Rotate(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Perform a plane rotation based on mouse movement.
void Init(StateMachineAction *stateMachineAction, InteractionEvent *interactionEvent)
Initialize interaction coordinates at the start of a gesture.
Provides state machine functionality for DataInteractors.
Base class for all interaction events in MITK.
Represents an action that is executed after a certain event in the state machine mechanism.
Find image slices visible on a given plane.
double ScalarType
Scalar type used throughout MITK for geometric computations.
Interface for observing all InteractionEvents dispatched through the system.