Medical Imaging Interaction Toolkit  2025.12.02
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 {
34  {
35  public:
36 
37  using OberserverTagType = unsigned long;
38 
40 
53 
71  const StdFunctionCommand::ActionFunction& actionFunction,
72  const StdFunctionCommand::FilterFunction& filterFunction = [](const itk::EventObject&) { return true; });
73 
85 
86  const std::vector<OberserverTagType>& GetAllObserverTags() { return m_ObserverTags; }
87 
102  void InitActions(std::string prefixFilter = "");
103 
104  protected:
105 
114  virtual void InitActionsImpl(const std::string& prefixFilter = "");
115 
117  std::vector<OberserverTagType> m_ObserverTags;
118 
119  };
120 
121 } // end namespace mitk
122 
123 #endif
#define MITKCORE_EXPORT
This class serves as an event state machine while simultaneously observing interaction events....
This class simplifies the process of adding an itkEventObject-itkCommand pair as an observer of a Dis...
std::vector< OberserverTagType > m_ObserverTags
virtual void InitActionsImpl(const std::string &prefixFilter="")
Sub-classes need to implement this function to define a customized behavior for default action pre-de...
void SetObservableBroadcast(DisplayActionEventBroadcast *observableBroadcast)
Sets the display action event broadcast class that should be observed. This class receives events fro...
WeakPointer< DisplayActionEventBroadcast > m_ObservableBroadcast
OberserverTagType ConnectDisplayActionEvent(const DisplayActionEvent &displayActionEvent, const StdFunctionCommand::ActionFunction &actionFunction, const StdFunctionCommand::FilterFunction &filterFunction=[](const itk::EventObject &) { return true;})
Uses the given std::functions to customize a command: The display action event is used to define on w...
void DisconnectObserver(OberserverTagType observerTag)
Uses the given observer tag to remove the corresponding custom command as an observer of the observed...
void InitActions(std::string prefixFilter="")
This function can be used by sub-classes to initialize a set of pre-defined DisplayActionEventFunctio...
const std::vector< OberserverTagType > & GetAllObserverTags()
std::function< void(const itk::EventObject &)> ActionFunction
std::function< bool(const itk::EventObject &)> FilterFunction
Find image slices visible on a given plane.