Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkVirtualTrackerTypeInformation.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
16 
17 namespace mitk
18 {
20  {
21  return "Virtual Tracker";
22  }
23 
25  {
26  TrackingDeviceData data = { VirtualTrackerTypeInformation::GetTrackingDeviceName(), "Virtual Tracker", "cube", "X" };
27  return data;
28  }
29 
31  {
34  }
35 
37  {
38  }
39 
40  mitk::TrackingDeviceSource::Pointer VirtualTrackerTypeInformation::CreateTrackingDeviceSource(
41  mitk::TrackingDevice::Pointer trackingDevice,
42  mitk::NavigationToolStorage::Pointer navigationTools,
43  std::string* errorMessage,
44  std::vector<int>* toolCorrespondencesInToolStorage)
45  {
46  mitk::TrackingDeviceSource::Pointer returnValue = mitk::TrackingDeviceSource::New();
47  mitk::VirtualTrackingDevice::Pointer thisDevice = dynamic_cast<mitk::VirtualTrackingDevice*>(trackingDevice.GetPointer());
48  *toolCorrespondencesInToolStorage = std::vector<int>();
49 
50  //add the tools to the tracking device
51  for (unsigned int i = 0; i < navigationTools->GetToolCount(); i++)
52  {
53  mitk::NavigationTool::Pointer thisNavigationTool = navigationTools->GetTool(i);
54  toolCorrespondencesInToolStorage->push_back(i);
55  bool toolAddSuccess = thisDevice->AddTool(thisNavigationTool->GetToolName().c_str());
56  if (!toolAddSuccess)
57  {
58  //todo error handling
59  errorMessage->append("Can't add tool, is the toolfile valid?");
60  return nullptr;
61  }
62  thisDevice->GetTool(i)->SetToolTipPosition(thisNavigationTool->GetToolTipPosition(),
63  thisNavigationTool->GetToolAxisOrientation());
64  }
65  returnValue->SetTrackingDevice(thisDevice);
66  return returnValue;
67  }
68 }
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< TrackingDeviceData > m_TrackingDeviceData
TrackingDeviceSource::Pointer CreateTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools, std::string *errorMessage, std::vector< int > *toolCorrespondencesInToolStorage) override
Class representing a tracking device which generates random positions / orientations. No hardware is needed for tracking device.