Medical Imaging Interaction Toolkit  2026.06.00
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:
62  virtual ~Interactor();
63 
72 
88  void SetToolManager(ToolManager* toolManager);
89 
105 
121  void Enable(PromptType promptType);
122 
132  void Disable();
133 
141  bool IsEnabled() const;
142 
152  void Reset();
153 
162  std::string GetIcon() const;
163 
174  std::string GetCursor(PromptType promptType) const;
175 
184  virtual bool HasInteractions() const = 0;
185 
197  virtual void RemoveLastInteraction(PromptType promptType) = 0;
198 
208 
209  protected:
218  explicit Interactor(InteractionType type);
219 
227  virtual void OnSetToolManager();
228 
240  virtual void OnHandleEvent(InteractionEvent* event);
241 
249  virtual void OnEnable() = 0;
250 
258  virtual void OnDisable() = 0;
259 
270  virtual void OnReset() = 0;
271 
282 
295 
306 
307  private:
308  class Impl;
309  std::unique_ptr<Impl> m_Impl;
310  };
311 }
312 
313 #endif
#define MITKPYTHONSEGMENTATION_EXPORT
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
Base class for all interaction events in MITK.
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.
virtual ~Interactor()
Destructor.
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.
void Disable()
Disables the interactor.
virtual bool HasInteractions() const =0
Checks whether any interactions have occurred.
virtual void OnHandleEvent(InteractionEvent *event)
Called when an interaction event is received.
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.
Interactor(InteractionType type)
Constructs an interactor with a given type.
virtual void RemoveLastInteraction(PromptType promptType)=0
Removes the most recent interaction for the given prompt type.
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.
InteractionType
Specifies the types of interactions available.
PromptType
Specifies the types of prompts used in nnInteractive.
Find image slices visible on a given plane.