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

Implementation of the PointSetInteractor. More...

#include <mitkPointSetDataInteractor.h>

Inheritance diagram for mitk::PointSetDataInteractor:
Collaboration diagram for mitk::PointSetDataInteractor:

Public Member Functions

 mitkClassMacro (PointSetDataInteractor, DataInteractor)
 
Pointer Clone () const
 
void SetAccuracy (float accuracy)
 Set the maximum distance for selecting a point by position. More...
 
void SetMaxPoints (unsigned int maxNumber=0)
 Set the maximum number of points allowed in the point set. More...
 
void EnableMovement (bool enabled=true)
 Enable or disable point movement. More...
 
void EnableRemoval (bool enabled=true)
 Enable or disable point removal. More...
 
void Enable3DPointPlacement (bool enabled=true)
 Enable or disable point placement in 3D render windows. More...
 
void SetBounds (BaseGeometry *geometry)
 Set the boundaries within which points can be placed. More...
 
- Public Member Functions inherited from mitk::DataInteractor
 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 Member Functions inherited from mitk::DataInteractor
static Pointer New ()
 

Protected Member Functions

 PointSetDataInteractor ()
 
 ~PointSetDataInteractor () override
 
void ConnectActionsAndFunctions () override
 
void DataNodeChanged () override
 
virtual int GetPointIndexByPosition (Point3D position, unsigned int time=0, float accuracy=-1)
 Return index in PointSet of the point that is within given accuracy to the provided position. More...
 
virtual bool CheckSelection (const InteractionEvent *interactionEvent)
 Check whether the pointer is over a point in the point set. More...
 
virtual bool CanAddPoint (const InteractionEvent *interactionEvent)
 Check whether a new point can be added. More...
 
virtual void AddPoint (StateMachineAction *, InteractionEvent *event)
 
virtual void RemovePoint (StateMachineAction *, InteractionEvent *interactionEvent)
 
virtual void IsClosedContour (StateMachineAction *, InteractionEvent *)
 
virtual void MovePoint (StateMachineAction *, InteractionEvent *)
 
virtual void InitMove (StateMachineAction *, InteractionEvent *interactionEvent)
 
virtual void FinishMove (StateMachineAction *, InteractionEvent *)
 
virtual void SelectPoint (StateMachineAction *, InteractionEvent *)
 
virtual void UnSelectPointAtPosition (StateMachineAction *, InteractionEvent *)
 
virtual void UnSelectAll (StateMachineAction *, InteractionEvent *)
 
virtual void UpdatePointSet (StateMachineAction *stateMachineAction, InteractionEvent *)
 Update the member variable that holds the point set. More...
 
virtual void Abort (StateMachineAction *, InteractionEvent *)
 
virtual void KeyDelete (StateMachineAction *, InteractionEvent *)
 Delete the currently selected point via keyboard action. More...
 
void UnselectAll (unsigned int timeStep, ScalarType timeInMs)
 
void SelectPoint (int position, unsigned int timeStep, ScalarType timeInMS)
 
- Protected Member Functions inherited from mitk::DataInteractor
 DataInteractor ()
 
 ~DataInteractor () override
 
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 ()
 

Protected Attributes

Point3D m_LastPoint
 to calculate a direction vector from last point and actual point More...
 
Vector3D m_SumVec
 summ-vector for Movement More...
 
PointSet::Pointer m_PointSet
 
int m_MaxNumberOfPoints
 
float m_SelectionAccuracy
 
bool m_IsMovementEnabled
 
bool m_IsRemovalEnabled
 
bool m_Is3DPointPlacementEnabled
 
mitk::BaseGeometry::Pointer m_Bounds
 
- Protected Attributes inherited from mitk::EventStateMachine
bool m_IsActive
 
UndoController * m_UndoController
 
bool m_UndoEnabled
 

Additional Inherited Members

- Public Types inherited from mitk::EventStateMachine
typedef itk::SmartPointer< StateMachineState > StateMachineStateType
 
- Static Public Attributes inherited from mitk::DataInteractor
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 Types inherited from mitk::EventStateMachine
typedef MessageAbstractDelegate2< StateMachineAction *, InteractionEvent *, void > ActionFunctionDelegate
 
typedef MessageAbstractDelegate1< const InteractionEvent *, bool > ConditionFunctionDelegate
 

Detailed Description

Implementation of the PointSetInteractor.

Interactor that operates on a point set and supports:

  • adding points
  • removing points
  • moving single points
  • moving the complete point set
  • selecting/unselecting a point

in 2D and 3D render windows.

Warning
If this Interactor is assigned (SetDataNode) an empty mitk::DataNode it creates a point set. Changing the point set of the assigned mitk::DataNode after this assignment will cause the mitk::PointSetDataInteractor to not work properly. The usage must follow this general scheme:
// Set up interactor
m_CurrentInteractor = mitk::PointSetDataInteractor::New();
m_CurrentInteractor->LoadStateMachine("PointSet.xml");
m_CurrentInteractor->SetEventConfig("PointSetConfig.xml");
// Create new PointSet which will receive the interaction input
m_TestPointSet = mitk::PointSet::New();
// Add the point set to the DataNode *before* the DataNode is added to the PointSetDataInteractor
m_TestPointSetNode->SetData(m_TestPointSet);
// Finally add the DataNode (which already is added to the DataStorage) to the PointSetDataInteractor
m_CurrentInteractor->SetDataNode(m_TestPointSetNode);
static Pointer New()
See also
DataInteractor
PointSet

Definition at line 59 of file mitkPointSetDataInteractor.h.

Constructor & Destructor Documentation

◆ PointSetDataInteractor()

mitk::PointSetDataInteractor::PointSetDataInteractor ( )
protected

◆ ~PointSetDataInteractor()

mitk::PointSetDataInteractor::~PointSetDataInteractor ( )
overrideprotected

Member Function Documentation

◆ Abort()

virtual void mitk::PointSetDataInteractor::Abort ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Calls for inactivation of the DataInteractor

◆ AddPoint()

virtual void mitk::PointSetDataInteractor::AddPoint ( StateMachineAction *  ,
InteractionEvent *  event 
)
protectedvirtual

Adds a point at the given coordinates. Every time a point is added it is also checked if the maximal number of points is reached, and if so an InternalEvent with the signal name "MaxNumberOfPoints" is triggered.

Reimplemented in mitk::SinglePointDataInteractor.

◆ CanAddPoint()

virtual bool mitk::PointSetDataInteractor::CanAddPoint ( const InteractionEvent *  interactionEvent)
protectedvirtual

Check whether a new point can be added.

Returns true unless 3D point placement is disabled and the event originates from a 3D render window.

◆ CheckSelection()

virtual bool mitk::PointSetDataInteractor::CheckSelection ( const InteractionEvent *  interactionEvent)
protectedvirtual

Check whether the pointer is over a point in the point set.

Returns
true if a point is within selection accuracy of the event position.

◆ Clone()

Pointer mitk::PointSetDataInteractor::Clone ( ) const

◆ ConnectActionsAndFunctions()

void mitk::PointSetDataInteractor::ConnectActionsAndFunctions ( )
overrideprotectedvirtual

Here actions strings from the loaded state machine pattern are mapped to functions of the DataInteractor. These functions are called when an action from the state machine pattern is executed.

Reimplemented from mitk::DataInteractor.

◆ DataNodeChanged()

void mitk::PointSetDataInteractor::DataNodeChanged ( )
overrideprotectedvirtual

This function is called when a DataNode has been set/changed. It is used to initialize the DataNode, e.g. if no PointSet exists yet it is created and added to the DataNode.

Reimplemented from mitk::DataInteractor.

Reimplemented in mitk::SinglePointDataInteractor.

◆ Enable3DPointPlacement()

void mitk::PointSetDataInteractor::Enable3DPointPlacement ( bool  enabled = true)

Enable or disable point placement in 3D render windows.

Parameters
enabledIf true (default), points can be placed in 3D views.

◆ EnableMovement()

void mitk::PointSetDataInteractor::EnableMovement ( bool  enabled = true)

Enable or disable point movement.

Parameters
enabledIf true (default), points can be moved interactively.

◆ EnableRemoval()

void mitk::PointSetDataInteractor::EnableRemoval ( bool  enabled = true)

Enable or disable point removal.

Parameters
enabledIf true (default), points can be removed interactively.

◆ FinishMove()

virtual void mitk::PointSetDataInteractor::FinishMove ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Is called when a movement is finished, changes back to regular color.

◆ GetPointIndexByPosition()

virtual int mitk::PointSetDataInteractor::GetPointIndexByPosition ( Point3D  position,
unsigned int  time = 0,
float  accuracy = -1 
)
protectedvirtual

Return index in PointSet of the point that is within given accuracy to the provided position.

Assumes that the DataNode contains a PointSet, if so it iterates over all points in the DataNode to check if it contains a point near the pointer position. If a point is found its index-position is returned, else -1 is returned.

◆ InitMove()

virtual void mitk::PointSetDataInteractor::InitMove ( StateMachineAction *  ,
InteractionEvent *  interactionEvent 
)
protectedvirtual

Initializes the movement, stores starting position.

◆ IsClosedContour()

virtual void mitk::PointSetDataInteractor::IsClosedContour ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Checks if new point is close enough to an old one, if so, trigger the ClosedContour signal which can be caught by the state machine.

◆ KeyDelete()

virtual void mitk::PointSetDataInteractor::KeyDelete ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Delete the currently selected point via keyboard action.

◆ mitkClassMacro()

mitk::PointSetDataInteractor::mitkClassMacro ( PointSetDataInteractor  ,
DataInteractor   
)

◆ MovePoint()

virtual void mitk::PointSetDataInteractor::MovePoint ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Moves the currently selected point to the new coordinates.

◆ New()

static Pointer mitk::PointSetDataInteractor::New ( )
static

◆ RemovePoint()

virtual void mitk::PointSetDataInteractor::RemovePoint ( StateMachineAction *  ,
InteractionEvent *  interactionEvent 
)
protectedvirtual

Removes point that is selected

◆ SelectPoint() [1/2]

void mitk::PointSetDataInteractor::SelectPoint ( int  position,
unsigned int  timeStep,
ScalarType  timeInMS 
)
protected

◆ SelectPoint() [2/2]

virtual void mitk::PointSetDataInteractor::SelectPoint ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Selects a point from the PointSet as currently active.

◆ SetAccuracy()

void mitk::PointSetDataInteractor::SetAccuracy ( float  accuracy)

Set the maximum distance for selecting a point by position.

Sets the maximum distance that is accepted when looking for a point at a certain position using the GetPointIndexByPosition function.

Parameters
accuracyThe selection accuracy (distance threshold) in world units.

◆ SetBounds()

void mitk::PointSetDataInteractor::SetBounds ( BaseGeometry *  geometry)

Set the boundaries within which points can be placed.

Points outside the given geometry will be rejected on add, and clamped during movement.

Parameters
geometryThe geometry defining the allowed region, or nullptr to remove bounds.

◆ SetMaxPoints()

void mitk::PointSetDataInteractor::SetMaxPoints ( unsigned int  maxNumber = 0)

Set the maximum number of points allowed in the point set.

Default is zero, which allows an infinite number of points. When the maximum is reached, an InternalEvent "MaximalNumberOfPoints" is fired.

Parameters
maxNumberMaximum number of allowed points (0 for unlimited).

◆ UnSelectAll()

virtual void mitk::PointSetDataInteractor::UnSelectAll ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Unselects all points out of reach.

◆ UnselectAll()

void mitk::PointSetDataInteractor::UnselectAll ( unsigned int  timeStep,
ScalarType  timeInMs 
)
protected

◆ UnSelectPointAtPosition()

virtual void mitk::PointSetDataInteractor::UnSelectPointAtPosition ( StateMachineAction *  ,
InteractionEvent *   
)
protectedvirtual

Unselects a point at the given coordinate.

◆ UpdatePointSet()

virtual void mitk::PointSetDataInteractor::UpdatePointSet ( StateMachineAction *  stateMachineAction,
InteractionEvent *   
)
protectedvirtual

Update the member variable that holds the point set.

Re-reads the PointSet from the DataNode, evaluating the time step of the sender.

Member Data Documentation

◆ m_Bounds

mitk::BaseGeometry::Pointer mitk::PointSetDataInteractor::m_Bounds
protected

Definition at line 230 of file mitkPointSetDataInteractor.h.

◆ m_Is3DPointPlacementEnabled

bool mitk::PointSetDataInteractor::m_Is3DPointPlacementEnabled
protected

Definition at line 229 of file mitkPointSetDataInteractor.h.

◆ m_IsMovementEnabled

bool mitk::PointSetDataInteractor::m_IsMovementEnabled
protected

Definition at line 227 of file mitkPointSetDataInteractor.h.

◆ m_IsRemovalEnabled

bool mitk::PointSetDataInteractor::m_IsRemovalEnabled
protected

Definition at line 228 of file mitkPointSetDataInteractor.h.

◆ m_LastPoint

Point3D mitk::PointSetDataInteractor::m_LastPoint
protected

to calculate a direction vector from last point and actual point

Definition at line 218 of file mitkPointSetDataInteractor.h.

◆ m_MaxNumberOfPoints

int mitk::PointSetDataInteractor::m_MaxNumberOfPoints
protected

Definition at line 225 of file mitkPointSetDataInteractor.h.

◆ m_PointSet

PointSet::Pointer mitk::PointSetDataInteractor::m_PointSet
protected

Definition at line 224 of file mitkPointSetDataInteractor.h.

◆ m_SelectionAccuracy

float mitk::PointSetDataInteractor::m_SelectionAccuracy
protected

Definition at line 226 of file mitkPointSetDataInteractor.h.

◆ m_SumVec

Vector3D mitk::PointSetDataInteractor::m_SumVec
protected

summ-vector for Movement

Definition at line 221 of file mitkPointSetDataInteractor.h.


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