Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::DataInteractor Class Reference

Base class for interactors that operate on DataNodes. More...

#include <mitkDataInteractor.h>

Inheritance diagram for mitk::DataInteractor:
Collaboration diagram for mitk::DataInteractor:

Public Member Functions

 mitkClassMacro (DataInteractor, EventStateMachine)
 
Pointer Clone () const
 
DataNode * GetDataNode () const
 Get the DataNode associated with this interactor. More...
 
virtual void SetDataNode (DataNode *dataNode)
 Set the DataNode that this interactor operates on. More...
 
int GetLayer () const
 Get the rendering layer of the associated DataNode. More...
 
ProcessEventMode GetMode () const
 Get the current event processing mode from the state machine's current state. More...
 
- Public Member Functions inherited from mitk::EventStateMachine
 mitkClassMacro (EventStateMachine, InteractionEventHandler)
 
bool LoadStateMachine (const std::string &filename, const us::Module *module=nullptr)
 Load a state machine pattern from an XML resource file. More...
 
bool HandleEvent (InteractionEvent *event, DataNode *dataNode)
 Process an incoming interaction event. More...
 
void EnableUndo (bool enable)
 Enable or disable the undo mechanism for this state machine. More...
 
void EnableInteraction (bool enable)
 Enable or disable the state machine. More...
 
- Public Member Functions inherited from mitk::InteractionEventHandler
 mitkClassMacroItkParent (InteractionEventHandler, itk::Object)
 
bool SetEventConfig (const std::string &filename, const us::Module *module=nullptr)
 Loads a configuration from an XML resource. More...
 
bool SetEventConfig (const EventConfig &config)
 Loads a configuration from an EventConfig object. More...
 
EventConfig GetEventConfig () const
 Returns the current configuration. More...
 
bool AddEventConfig (const std::string &filename, const us::Module *module=nullptr)
 This method extends the configuration. More...
 
bool AddEventConfig (const EventConfig &config)
 This method extends the configuration. The configuration from the EventConfig object is loaded and only the ones conflicting are replaced by the new one. This way several configurations can be combined. More...
 

Static Public Member Functions

static Pointer New ()
 

Static Public Attributes

static const std::string IntDeactivateMe
 Internal signal name to request deactivation of this interactor. More...
 
static const std::string IntLeaveWidget
 Internal signal name indicating the pointer left the widget area. More...
 
static const std::string IntEnterWidget
 Internal signal name indicating the pointer entered the widget area. More...
 

Protected Member Functions

 DataInteractor ()
 
 ~DataInteractor () override
 
void ConnectActionsAndFunctions () override
 Overwrite this function to connect actions from StateMachine description with functions. More...
 
virtual void DataNodeChanged ()
 Is called when a DataNode is initially set or changed To be implemented by sub-classes for initialization code which require a DataNode. More...
 
virtual void NotifyStart ()
 Sends StartInteraction event via the mitk::DataNode. More...
 
virtual void NotifyResultReady ()
 NotifyResultReady Sends ResultReady event via the mitk::DataNode. More...
 
- Protected Member Functions inherited from mitk::EventStateMachine
 EventStateMachine ()
 
 ~EventStateMachine () override
 
void AddActionFunction (const std::string &action, const ActionFunctionDelegate &delegate)
 
void AddConditionFunction (const std::string &condition, const ConditionFunctionDelegate &delegate)
 
StateMachineState * GetCurrentState () const
 
void ResetToStartState ()
 ResetToStartState Reset state machine to it initial starting state. More...
 
virtual bool CheckCondition (const StateMachineCondition &condition, const InteractionEvent *interactionEvent)
 
virtual void ExecuteAction (StateMachineAction *action, InteractionEvent *interactionEvent)
 
virtual bool FilterEvents (InteractionEvent *interactionEvent, DataNode *dataNode)
 
void SetMouseCursor (const char *xpm[], int hotspotX, int hotspotY)
 Sets the specified mouse cursor. More...
 
void ResetMouseCursor ()
 Resets the mouse cursor to its original state. More...
 
StateMachineTransition * GetExecutableTransition (InteractionEvent *event)
 Returns the executable transition for the given event. More...
 
- Protected Member Functions inherited from mitk::InteractionEventHandler
 InteractionEventHandler ()
 
 ~InteractionEventHandler () override
 
PropertyList::Pointer GetAttributes () const
 
std::string MapToEventVariant (InteractionEvent *interactionEvent)
 
virtual void ConfigurationChanged ()
 

Additional Inherited Members

- Public Types inherited from mitk::EventStateMachine
typedef itk::SmartPointer< StateMachineState > StateMachineStateType
 
- Protected Types inherited from mitk::EventStateMachine
typedef MessageAbstractDelegate2< StateMachineAction *, InteractionEvent *, void > ActionFunctionDelegate
 
typedef MessageAbstractDelegate1< const InteractionEvent *, bool > ConditionFunctionDelegate
 
- Protected Attributes inherited from mitk::EventStateMachine
bool m_IsActive
 
UndoController * m_UndoController
 
bool m_UndoEnabled
 

Detailed Description

Base class for interactors that operate on DataNodes.

DataInteractor provides the interface required for an interactor to work together with the Dispatcher. Each DataInteractor is associated with exactly one DataNode and processes events according to its loaded state machine pattern.

To implement a new interactor, subclass DataInteractor and override ConnectActionsAndFunctions() to bind state machine action names to member functions.

The processing priority is determined by the "layer" property of the associated DataNode (higher layers are handled first).

See also
EventStateMachine
Dispatcher
DataNode

Definition at line 59 of file mitkDataInteractor.h.

Constructor & Destructor Documentation

◆ DataInteractor()

mitk::DataInteractor::DataInteractor ( )
protected

◆ ~DataInteractor()

mitk::DataInteractor::~DataInteractor ( )
overrideprotected

Member Function Documentation

◆ Clone()

Pointer mitk::DataInteractor::Clone ( ) const

◆ ConnectActionsAndFunctions()

void mitk::DataInteractor::ConnectActionsAndFunctions ( )
overrideprotectedvirtual

Overwrite this function to connect actions from StateMachine description with functions.

Following example shows how to connect the 'addpoint' action from the StateMachine XML description using the CONNECT_FUNCTION macro with the AddPoint() function in the TestInteractor.

void mitk::TestInteractor::ConnectActionsAndFunctions()
{
CONNECT_FUNCTION("addpoint", AddPoint);
}
#define CONNECT_FUNCTION(a, f)

Reimplemented from mitk::EventStateMachine.

Reimplemented in mitk::ContourModelLiveWireInteractor, mitk::ContourModelInteractor, mitk::PlanarFigureInteractor, mitk::SurfaceDeformationDataInteractor3D, mitk::ClippingPlaneInteractor3D, mitk::AffineImageCropperInteractor, mitk::AffineBaseDataInteractor3D, and mitk::PointSetDataInteractor.

◆ DataNodeChanged()

virtual void mitk::DataInteractor::DataNodeChanged ( )
protectedvirtual

Is called when a DataNode is initially set or changed To be implemented by sub-classes for initialization code which require a DataNode.

Note
New DataInteractors usually are expected to have the focus, but this only works if they have the highest Layer, since empty DataNodes have a layer of -1, the DataNode must be filled here in order to get a layer assigned.
Is also called when the DataNode is set to nullptr.

Reimplemented in mitk::SurfaceDeformationDataInteractor3D, mitk::ClippingPlaneInteractor3D, mitk::AffineImageCropperInteractor, mitk::AffineBaseDataInteractor3D, mitk::SinglePointDataInteractor, mitk::PointSetDataInteractor, and mitk::BoundingShapeInteractor.

◆ GetDataNode()

DataNode* mitk::DataInteractor::GetDataNode ( ) const

Get the DataNode associated with this interactor.

Returns
Pointer to the DataNode, or nullptr if none is set.

◆ GetLayer()

int mitk::DataInteractor::GetLayer ( ) const

Get the rendering layer of the associated DataNode.

The layer determines the priority in event dispatching (higher layers first).

Returns
The integer layer value, or -1 if no DataNode is set.

◆ GetMode()

ProcessEventMode mitk::DataInteractor::GetMode ( ) const

Get the current event processing mode from the state machine's current state.

The mode determines how the Dispatcher handles event distribution:

  • REGULAR: normal dispatching
  • PREFERINPUT: this interactor is preferred but others can still receive events
  • GRABINPUT: only this interactor receives events
Returns
The current ProcessEventMode.

◆ mitkClassMacro()

mitk::DataInteractor::mitkClassMacro ( DataInteractor  ,
EventStateMachine   
)

◆ New()

static Pointer mitk::DataInteractor::New ( )
static

◆ NotifyResultReady()

virtual void mitk::DataInteractor::NotifyResultReady ( )
protectedvirtual

NotifyResultReady Sends ResultReady event via the mitk::DataNode.

Use to get notfied when the mitk::DataNode is in a ready state for further processing.

◆ NotifyStart()

virtual void mitk::DataInteractor::NotifyStart ( )
protectedvirtual

Sends StartInteraction event via the mitk::DataNode.

◆ SetDataNode()

virtual void mitk::DataInteractor::SetDataNode ( DataNode *  dataNode)
virtual

Set the DataNode that this interactor operates on.

Removes the interactor from any previously associated DataNode, assigns this interactor to the new DataNode, and calls DataNodeChanged().

Parameters
[in]dataNodeThe DataNode to associate. Can be nullptr to detach.

Reimplemented in mitk::AffineBaseDataInteractor3D, and mitk::BoundingShapeInteractor.

Member Data Documentation

◆ IntDeactivateMe

const std::string mitk::DataInteractor::IntDeactivateMe
static

Internal signal name to request deactivation of this interactor.

Definition at line 63 of file mitkDataInteractor.h.

◆ IntEnterWidget

const std::string mitk::DataInteractor::IntEnterWidget
static

Internal signal name indicating the pointer entered the widget area.

Definition at line 67 of file mitkDataInteractor.h.

◆ IntLeaveWidget

const std::string mitk::DataInteractor::IntLeaveWidget
static

Internal signal name indicating the pointer left the widget area.

Definition at line 65 of file mitkDataInteractor.h.


The documentation for this class was generated from the following file: