Medical Imaging Interaction Toolkit  2023.12.99-63768887
Medical Imaging Interaction Toolkit
MITK Tutorial - Step 5: Interactively add points

In addition to Step 4 where 3 views were created on the data, we now want to interactively add points.

A node containing a PointSet as data is added to the data tree and a PointSetDataInteractor is associated with the node, which handles the interaction. The interaction pattern is defined in a state-machine, stored in an external XML file. Thus, we need to load a state-machine.

A state machine describes interaction pattern with different states (states beeing something like "a point is selected") and transitions to these states (e.g. "select a point"). These transitions are associated with actions. In this way it is possible to model complex interaction schemes. By what these transitions and actions are triggered is described in a configuration file. It maps user events to identifiers that are used in the state machine patterns. In this way the user interaction can be changed by simply loading a different configuration file for a state machine, and the user may add points now with a right click instead of left click + SHIFT, as in our case.

Therefore after loading the state machine pattern the PointSetDataInteractor is also given a event configuration file.

More information about interaction in MITK can be found here.

In order to add a point the shift key has to be pressed while left clicking in a render window. You can also move points or remove them (left click while pressing ALT).

A PointSet and a node for it have to be created to be able to interactively adding points:

// Store the point set in the DataNode
pointSetNode->SetData(pointSet);
// Add the node to the tree
ds->Add(pointSetNode);
// Create PointSetDataInteractor
// Set the StateMachine pattern that describes the flow of the interactions
interactor->LoadStateMachine("PointSet.xml");
// Set the configuration file, which describes the user interactions that trigger actions
// in this file SHIFT + LeftClick triggers add Point, but by modifying this file,
// it could as well be changes to any other user interaction.
interactor->SetEventConfig("PointSetConfig.xml");
// Assign the pointSetNode to the interactor,
// alternatively one could also add the DataInteractor to the pointSetNode using the SetDataInteractor() method.
interactor->SetDataNode(pointSetNode);

[Previous step] [Next step] [Main tutorial page]

mitk::PointSetDataInteractor::New
static Pointer New()
itk::SmartPointer< Self >
mitk::PointSet::New
static Pointer New()
mitk::DataNode::New
static Pointer New()