MITK Tutorial - Step 5: Interactively add points

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

A node containing a PointSet as data is added to the data tree and a PointSetInteractor 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.

The interaction patterns defines the events, on which the interactor reacts (e.g., which mouse buttons are used to set a point), the transition to the next state (e.g., the initial may be "empty point set") and associated actions (e.g., add a point at the position where the mouse-click occured). More information about interaction in MITK can be found here.

In order to add a point the shift key has to be pressed simultaneously to marking the point with the mouse.

step5_result.png

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

  mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
  mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New();
  pointSetNode->SetData(pointSet);

  // Add the node to the tree
  ds->Add(pointSetNode);

  // Create PointSetInteractor, associate to pointSetNode and add as
  // interactor to GlobalInteraction
  mitk::GlobalInteraction::GetInstance()->AddInteractor(
    mitk::PointSetInteractor::New("pointsetinteractor", pointSetNode)

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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines