Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkDisplayActionEvents.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 mitkDisplayActionEvents_h
14 #define mitkDisplayActionEvents_h
15 
16 #include <MitkCoreExports.h>
17 
18 // mitk core
19 #include <mitkInteractionEvent.h>
20 
21 // itk
22 #include <itkEventObject.h>
23 
24 #include <mitkVector.h>
25 #include <mitkPoint.h>
26 
27 namespace mitk
28 {
39  class MITKCORE_EXPORT DisplayActionEvent : public itk::AnyEvent
40  {
41  public:
43  typedef itk::AnyEvent Superclass;
44 
46  DisplayActionEvent() : m_InteractionEvent(nullptr) {}
47 
52  DisplayActionEvent(InteractionEvent* interactionEvent) : m_InteractionEvent(interactionEvent) {}
53  ~DisplayActionEvent() override {}
54  const char* GetEventName() const override { return "DisplayActionEvent"; }
55  bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
56  itk::EventObject* MakeObject() const override { return new Self(m_InteractionEvent); }
57 
62  InteractionEvent* GetInteractionEvent() const { return m_InteractionEvent; }
63 
69  {
70  return m_InteractionEvent != nullptr ? m_InteractionEvent->GetSender() : nullptr;
71  }
72 
74  DisplayActionEvent(const Self& s) : Superclass(s), m_InteractionEvent(s.GetInteractionEvent()) {};
75 
76  private:
77  InteractionEvent* m_InteractionEvent;
78  void operator=(const Self &);
79  };
80 
86  {
87  public:
90 
92 
98  DisplayMoveEvent(InteractionEvent* interactionEvent, const Vector2D& moveVector)
99  : Superclass(interactionEvent)
100  , m_MoveVector(moveVector)
101  {
102  }
103  ~DisplayMoveEvent() override {}
104  const char* GetEventName() const override { return "DisplayMoveEvent"; }
105  bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
106  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_MoveVector); }
107 
112  const Vector2D& GetMoveVector() const { return m_MoveVector; }
113 
115  DisplayMoveEvent(const Self& s) : Superclass(s), m_MoveVector(s.GetMoveVector()) {};
116 
117  private:
118  Vector2D m_MoveVector;
119  };
120 
126  {
127  public:
130 
132 
138  DisplaySetCrosshairEvent(InteractionEvent* interactionEvent, const Point3D& position)
139  : Superclass(interactionEvent)
140  , m_Position(position)
141  {
142  }
144  const char* GetEventName() const override { return "DisplaySetCrosshairEvent"; }
145  bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
146  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_Position); }
147 
152  const Point3D& GetPosition() const { return m_Position; }
153 
155  DisplaySetCrosshairEvent(const Self& s) : Superclass(s), m_Position(s.GetPosition()) {};
156 
157  private:
158  Point3D m_Position;
159  };
160 
166  {
167  public:
170 
172 
179  DisplayZoomEvent(InteractionEvent* interactionEvent, float zoomFactor, const Point2D& startCoordinate)
180  : Superclass(interactionEvent)
181  , m_ZoomFactor(zoomFactor)
182  , m_StartCoordinate(startCoordinate)
183  {
184  }
185  ~DisplayZoomEvent() override {}
186  const char* GetEventName() const override { return "DisplayZoomEvent"; }
187  bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
188  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_ZoomFactor, m_StartCoordinate); }
189 
194  float GetZoomFactor() const { return m_ZoomFactor; }
195 
200  const Point2D& GetStartCoordinate() const { return m_StartCoordinate; }
201 
203  DisplayZoomEvent(const Self& s) : Superclass(s), m_ZoomFactor(s.GetZoomFactor()), m_StartCoordinate(s.GetStartCoordinate()) {};
204 
205  private:
206  float m_ZoomFactor;
207  Point2D m_StartCoordinate;
208  };
209 
215  {
216  public:
219 
221 
228  DisplayScrollEvent(InteractionEvent* interactionEvent, int sliceDelta, bool autoRepeat)
229  : Superclass(interactionEvent)
230  , m_SliceDelta(sliceDelta)
231  , m_AutoRepeat(autoRepeat)
232  {
233  }
234  ~DisplayScrollEvent() override {}
235  const char* GetEventName() const override { return "DisplayScrollEvent"; }
236  bool CheckEvent(const itk::EventObject *e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
237  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_SliceDelta, m_AutoRepeat); }
238 
243  int GetSliceDelta() const { return m_SliceDelta; }
244 
249  bool GetAutoRepeat() const { return m_AutoRepeat; }
250 
252  DisplayScrollEvent(const Self& s) : Superclass(s), m_SliceDelta(s.GetSliceDelta()), m_AutoRepeat(s.GetAutoRepeat()) {};
253 
254  private:
255  int m_SliceDelta;
256  bool m_AutoRepeat;
257  };
258 
264  {
265  public:
268 
270 
278  : Superclass(interactionEvent)
279  , m_Level(level)
280  , m_Window(window)
281  {
282  }
284  const char* GetEventName() const override { return "DisplaySetLevelWindowEvent"; }
285  bool CheckEvent(const itk::EventObject *e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
286  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_Level, m_Window); }
287 
292  ScalarType GetLevel() const { return m_Level; }
293 
298  ScalarType GetWindow() const { return m_Window; }
299 
301  DisplaySetLevelWindowEvent(const Self& s) : Superclass(s), m_Level(s.GetLevel()), m_Window(s.GetWindow()) {};
302 
303  private:
304  ScalarType m_Level;
305  ScalarType m_Window;
306  };
307 
308 } // end namespace
309 
310 #endif
#define MITKCORE_EXPORT
Organizes the rendering process.
Base class for display action events broadcast by DisplayActionEventBroadcast.
bool CheckEvent(const itk::EventObject *e) const override
const char * GetEventName() const override
itk::EventObject * MakeObject() const override
InteractionEvent * GetInteractionEvent() const
Get the originating interaction event.
DisplayActionEvent(const Self &s)
Copy constructor.
DisplayActionEvent()
Default constructor with no interaction event.
BaseRenderer * GetSender() const
Get the BaseRenderer that sent the interaction event.
DisplayActionEvent(InteractionEvent *interactionEvent)
Construct with the originating interaction event.
Display action event carrying a 2D move vector for camera panning.
DisplayMoveEvent(const Self &s)
Copy constructor.
const Vector2D & GetMoveVector() const
Get the 2D move vector.
bool CheckEvent(const itk::EventObject *e) const override
itk::EventObject * MakeObject() const override
DisplayMoveEvent(InteractionEvent *interactionEvent, const Vector2D &moveVector)
Construct with the originating event and move vector.
const char * GetEventName() const override
Display action event carrying a slice scroll delta and auto-repeat flag.
bool CheckEvent(const itk::EventObject *e) const override
DisplayScrollEvent(InteractionEvent *interactionEvent, int sliceDelta, bool autoRepeat)
Construct with the originating event, slice delta, and auto-repeat flag.
int GetSliceDelta() const
Get the number of slices to scroll.
itk::EventObject * MakeObject() const override
const char * GetEventName() const override
bool GetAutoRepeat() const
Get whether auto-repeat (wrap-around) is enabled.
DisplayScrollEvent(const Self &s)
Copy constructor.
Display action event carrying a 3D world position for crosshair placement.
DisplaySetCrosshairEvent(InteractionEvent *interactionEvent, const Point3D &position)
Construct with the originating event and crosshair position.
const Point3D & GetPosition() const
Get the 3D crosshair position.
const char * GetEventName() const override
itk::EventObject * MakeObject() const override
bool CheckEvent(const itk::EventObject *e) const override
DisplaySetCrosshairEvent(const Self &s)
Copy constructor.
Display action event carrying level and window values for level-window adjustment.
itk::EventObject * MakeObject() const override
const char * GetEventName() const override
bool CheckEvent(const itk::EventObject *e) const override
ScalarType GetLevel() const
Get the level (center) value.
ScalarType GetWindow() const
Get the window (width) value.
DisplaySetLevelWindowEvent(InteractionEvent *interactionEvent, ScalarType level, ScalarType window)
Construct with the originating event, level, and window values.
DisplaySetLevelWindowEvent(const Self &s)
Copy constructor.
Display action event carrying a zoom factor and start coordinate.
bool CheckEvent(const itk::EventObject *e) const override
const Point2D & GetStartCoordinate() const
Get the zoom start coordinate.
float GetZoomFactor() const
Get the zoom factor.
itk::EventObject * MakeObject() const override
DisplayZoomEvent(const Self &s)
Copy constructor.
const char * GetEventName() const override
DisplayZoomEvent(InteractionEvent *interactionEvent, float zoomFactor, const Point2D &startCoordinate)
Construct with the originating event, zoom factor, and start coordinate.
Base class for all interaction events in MITK.
Find image slices visible on a given plane.
double ScalarType
Scalar type used throughout MITK for geometric computations.