Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkDisplayActionEventHandler.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 mitkDisplayActionEventHandler_h
14 #define mitkDisplayActionEventHandler_h
15 
16 #include <MitkCoreExports.h>
17 
18 // mitk core
21 #include <mitkStdFunctionCommand.h>
22 
23 namespace mitk
24 {
38  {
39  public:
40 
42  using OberserverTagType = unsigned long;
43 
46 
60 
76  const StdFunctionCommand::ActionFunction& actionFunction,
77  const StdFunctionCommand::FilterFunction& filterFunction = [](const itk::EventObject&) { return true; });
78 
90 
95  const std::vector<OberserverTagType>& GetAllObserverTags() { return m_ObserverTags; }
96 
108  void InitActions(std::string prefixFilter = "");
109 
110  protected:
111 
117  virtual void InitActionsImpl(const std::string& prefixFilter = "");
118 
120  std::vector<OberserverTagType> m_ObserverTags;
121 
122  };
123 
124 } // end namespace mitk
125 
126 #endif
#define MITKCORE_EXPORT
Event state machine that observes interaction events and broadcasts display action events.
Simplifies connecting display action event observers to a DisplayActionEventBroadcast.
std::vector< OberserverTagType > m_ObserverTags
virtual void InitActionsImpl(const std::string &prefixFilter="")
Override in sub-classes to define default display action connections.
void SetObservableBroadcast(DisplayActionEventBroadcast *observableBroadcast)
Set the DisplayActionEventBroadcast instance to observe.
WeakPointer< DisplayActionEventBroadcast > m_ObservableBroadcast
OberserverTagType ConnectDisplayActionEvent(const DisplayActionEvent &displayActionEvent, const StdFunctionCommand::ActionFunction &actionFunction, const StdFunctionCommand::FilterFunction &filterFunction=[](const itk::EventObject &) { return true;})
Register an observer for a specific display action event.
void DisconnectObserver(OberserverTagType observerTag)
Remove an observer identified by its tag.
void InitActions(std::string prefixFilter="")
Initialize pre-defined display actions and connect them to the broadcast.
unsigned long OberserverTagType
Tag type used to identify registered observers.
const std::vector< OberserverTagType > & GetAllObserverTags()
Get all currently registered observer tags.
virtual ~DisplayActionEventHandler()
Destructor. Removes all registered observers.
Base class for display action events broadcast by DisplayActionEventBroadcast.
std::function< void(const itk::EventObject &)> ActionFunction
Function type for the action to execute when the filter passes.
std::function< bool(const itk::EventObject &)> FilterFunction
Function type for filtering events. Returns true if the event should be handled.
A weak pointer that observes an itk::Object without preventing its deletion.
Find image slices visible on a given plane.