Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::InteractionEventObserver Class Referenceabstract

Interface for observing all InteractionEvents dispatched through the system. More...

#include <mitkInteractionEventObserver.h>

Inheritance diagram for mitk::InteractionEventObserver:

Public Member Functions

 InteractionEventObserver ()
 
virtual ~InteractionEventObserver ()
 
virtual void Notify (InteractionEvent *interactionEvent, bool isHandled)=0
 Called by the Dispatcher to notify this observer about an InteractionEvent. More...
 
void Disable ()
 Disable this observer so it no longer receives notifications. More...
 
void Enable ()
 Enable this observer so it receives notifications. More...
 
bool IsEnabled () const
 Check whether this observer is currently enabled. More...
 

Detailed Description

Interface for observing all InteractionEvents dispatched through the system.

Classes implementing this interface are notified about every InteractionEvent after it has been offered to all DataInteractors. Observers are registered as micro services and can optionally be scoped to a specific renderer.

This class also provides optional state machine infrastructure. See the Notify() method documentation for details on how to use it with or without a state machine.

See also
Dispatcher
EventStateMachine

Definition at line 41 of file mitkInteractionEventObserver.h.

Constructor & Destructor Documentation

◆ InteractionEventObserver()

mitk::InteractionEventObserver::InteractionEventObserver ( )

◆ ~InteractionEventObserver()

virtual mitk::InteractionEventObserver::~InteractionEventObserver ( )
virtual

Member Function Documentation

◆ Disable()

void mitk::InteractionEventObserver::Disable ( )

Disable this observer so it no longer receives notifications.

◆ Enable()

void mitk::InteractionEventObserver::Enable ( )

Enable this observer so it receives notifications.

◆ IsEnabled()

bool mitk::InteractionEventObserver::IsEnabled ( ) const

Check whether this observer is currently enabled.

Returns
True if enabled, false if disabled.

◆ Notify()

virtual void mitk::InteractionEventObserver::Notify ( InteractionEvent *  interactionEvent,
bool  isHandled 
)
pure virtual

Called by the Dispatcher to notify this observer about an InteractionEvent.

All registered InteractionEventObservers receive every event after it has been offered to DataInteractors. The isHandled flag indicates whether a DataInteractor has already handled the event. Observers that trigger actions should consider this flag to avoid confusing the user with multiple independent actions from one event.

To use state machine infrastructure, forward the event to HandleEvent():

void MyObserver::Notify(InteractionEvent::Pointer interactionEvent, bool isHandled)
{
if (!isHandled) {
this->HandleEvent(interactionEvent, nullptr);
}
}
Parameters
[in]interactionEventThe event being dispatched.
[in]isHandledTrue if a DataInteractor already handled this event.

Implemented in mitk::EventRecorder, mitk::Tool, mitk::DisplayActionEventBroadcast, and mitk::nnInteractiveTool.


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