Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitknnInteractiveInteractor.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 mitknnInteractiveInteractor_h
14 #define mitknnInteractiveInteractor_h
15 
16 #include <mitknnInteractiveEnums.h>
17 #include <mitkMessage.h>
18 
19 namespace mitk
20 {
21  class DataStorage;
22  class InteractionEvent;
23  class ToolManager;
24 }
25 
26 namespace mitk::nnInteractive
27 {
58  {
59  public:
60  virtual ~Interactor();
61 
68 
76  void SetToolManager(ToolManager* toolManager);
77 
85 
99  void Enable(PromptType promptType);
100 
110  void Disable();
111 
114  bool IsEnabled() const;
115 
125  void Reset();
126 
133  std::string GetIcon() const;
134 
141  std::string GetCursor(PromptType promptType) const;
142 
148  virtual bool HasInteractions() const = 0;
149 
155 
156  protected:
171 
179  virtual void OnSetToolManager() {};
180 
190  virtual void OnHandleEvent(InteractionEvent* /*event*/) {};
191 
199  virtual void OnEnable() = 0;
200 
208  virtual void OnDisable() = 0;
209 
220  virtual void OnReset() = 0;
221 
229 
237 
245 
246  private:
247  class Impl;
248  std::unique_ptr<Impl> m_Impl;
249  };
250 }
251 
252 #endif
#define MITKPYTHONSEGMENTATION_EXPORT
Data management class that handles 'was created by' relations.
Manages and coordinates instances of mitk::Tool.
Base class for all nnInteractive interactors.
ToolManager * GetToolManager() const
Returns the ToolManager associated with this interactor.
std::string GetIcon() const
Retrieves the SVG icon as a string from module resources.
virtual void OnReset()=0
Called when the interactor is reset.
DataStorage * GetDataStorage() const
Convenience method for accessing the DataStorage.
void Reset()
Resets the interactor to its initial state.
Interactor(InteractionType type, InteractionMode mode=InteractionMode::Default)
Constructs an interactor with a given type and mode.
virtual void OnDisable()=0
Called when the interactor is disabled.
PromptType GetCurrentPromptType() const
Returns the currently active prompt type.
void Enable(PromptType promptType)
Enables the interactor for the given prompt type.
void SetToolManager(ToolManager *toolManager)
Sets the ToolManager for this interactor.
Message1< bool > UpdatePreviewEvent
Event triggered after an interaction has occurred.
void HandleEvent(InteractionEvent *event)
Handles an interaction event.
virtual void OnHandleEvent(InteractionEvent *)
Called when an interaction event for a tool is received.
void Disable()
Disables the interactor.
virtual bool HasInteractions() const =0
Checks whether any interactions have occurred.
std::string GetCursor(PromptType promptType) const
Retrieves the SVG cursor as a string from module resources based on PromptType.
virtual void OnEnable()=0
Called when the interactor is enabled.
bool IsEnabled() const
Checks whether the interactor is currently enabled.
virtual void OnSetToolManager()
Called when a ToolManager is assigned.
InteractionType GetType() const
Returns the interaction type associated with this interactor.
InteractionMode
Specifies the interaction modes for interactors.
InteractionType
Specifies the types of interactions available.
PromptType
Specifies the types of prompts used in nnInteractive.
Find image slices visible on a given plane.