Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkRegistrationManipulationInteractor.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 mitkRegistrationManipulationInteractor_h
14 #define mitkRegistrationManipulationInteractor_h
15 
16 #include <mitkDataInteractor.h>
17 #include <mitkEventConfig.h>
19 #include <mitkPoint.h>
20 #include <mitkVector.h>
21 
22 #include <usServiceReference.h>
23 
25 
26 #include <map>
27 
28 namespace mitk
29 {
31  itkEventMacroDeclaration(RegistrationTranslationEvent, itk::AnyEvent);
32 
34  itkEventMacroDeclaration(RegistrationRotationEvent, itk::AnyEvent);
35 
37  itkEventMacroDeclaration(RegistrationSelectPositionEvent, itk::AnyEvent);
38 
67  {
68  public:
70  itkFactorylessNewMacro(Self);
71  itkCloneMacro(Self);
72 
75  void SetCenterOfRotation(const Point3D& center);
76 
79  {
81  double AngleDeg;
82  };
83 
85  const Vector3D& GetTranslationDelta() const;
86 
89 
92  const Point3D& GetSelectPosition() const;
93 
100 
104 
109 
114 
115  private:
118 
119  void ConnectActionsAndFunctions() override;
120 
121  // State machine actions: hover cursor foreshadowing
122  void HintTranslate(StateMachineAction*, InteractionEvent*);
123  void HintRotate(StateMachineAction*, InteractionEvent*);
124  void HintNeutral(StateMachineAction*, InteractionEvent*);
125 
126  // State machine actions: drag gestures
127  void InitTranslation(StateMachineAction*, InteractionEvent*);
128  void Translate(StateMachineAction*, InteractionEvent*);
129  void EndTranslation(StateMachineAction*, InteractionEvent*);
130 
131  void InitRotation(StateMachineAction*, InteractionEvent*);
132  void Rotate(StateMachineAction*, InteractionEvent*);
133  void EndRotation(StateMachineAction*, InteractionEvent*);
134 
135  void SelectPosition(StateMachineAction*, InteractionEvent*);
136 
137  // Interaction state
138  Point2D m_InitialClickPosition2D;
139  double m_InitialClickPosition2DZ = 0.0;
140  Point3D m_InitialClickPosition3D;
141 
142  Point2D m_CenterOfRotation2D;
143  Point3D m_CenterOfRotation;
144 
145  // Output deltas / positions (populated before emitting events)
146  Vector3D m_TranslationDelta;
147  RotationDelta m_RotationDelta;
148  Point3D m_SelectPosition;
149 
150  // Cursor management helpers
151  void PushCursorFromResource(const std::string& resourceName);
152  void PopCursorSafe();
153  int m_NumPushedCursors = 0;
154 
155  // Hover hint cursor tracking
156  enum class HintMode { None, Translate, Rotate };
157  HintMode m_CurrentHintMode = HintMode::None;
158 
159  // Saved DisplayActionEventBroadcast configs for restore on EnableOriginalInteraction()
160  bool m_OriginalInteractionDisabled = false;
161  std::map<us::ServiceReferenceU, EventConfig> m_DisplayInteractionConfigs;
162  };
163 
164 } // namespace mitk
165 
166 #endif
#define MITKMATCHPOINTREGISTRATION_EXPORT
Base class for interactors that operate on DataNodes.
Base class for all interaction events in MITK.
Data interactor for mouse-based registration manipulation in 2D render windows.
const Point3D & GetSelectPosition() const
mitkClassMacro(RegistrationManipulationInteractor, DataInteractor)
const RotationDelta & GetRotationDelta() const
void SetCenterOfRotation(const Point3D &center)
const Vector3D & GetTranslationDelta() const
Represents an action that is executed after a certain event in the state machine mechanism.
@ None
No anti-aliasing.
Find image slices visible on a given plane.
itkEventMacroDeclaration(BoundingShapeInteractionEvent, itk::AnyEvent)