Page MenuHomePhabricator

[QmitkIGTTutorial] Missing global reinit when using VirtualTrackingDevice
Closed, ResolvedPublic

Description

When using " Variant 2: Emulate a Tracking Device with mitk::VirtualTrackingDevice ", a global reinit is missing after the button "start tracking" is pressed.

A solution would be to add the following code after the call of StartTracking() in the OnStartIGT(() method to fix it in the tutorial.


mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();

   
// get all nodes that have not set "includeInBoundingBox" to false
mitk::NodePredicateNot::Pointer pred
  = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false)));

mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred);
// calculate bounding geometry of these nodes
mitk::TimeSlicedGeometry::Pointer geobounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs, "visible");

// initialize the views to the bounding geometry
renderWindow->GetRenderingManager()->InitializeViews(geobounds);

A more generic solution would probably be to integrate it into the VirtualTrackingDevice (when setting the bounds).

In order to use the code snippet above, you need to change the superclass from QmitkFunctionality to QmitkAbstractView.