Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
20 
21 namespace mitk
22 {
24  {
25  return "Virtual Tracker";
26  }
27 
29  {
30  TrackingDeviceData data = { VirtualTrackerTypeInformation::GetTrackingDeviceName(), "Virtual Tracker", "cube", "X" };
31  return data;
32  }
33 
35  {
38  }
39 
41  {
42  }
43 
45  mitk::TrackingDevice::Pointer trackingDevice,
47  std::string* errorMessage,
48  std::vector<int>* toolCorrespondencesInToolStorage)
49  {
51  mitk::VirtualTrackingDevice::Pointer thisDevice = dynamic_cast<mitk::VirtualTrackingDevice*>(trackingDevice.GetPointer());
52  *toolCorrespondencesInToolStorage = std::vector<int>();
53 
54  //add the tools to the tracking device
55  for (int i = 0; i < navigationTools->GetToolCount(); i++)
56  {
57  mitk::NavigationTool::Pointer thisNavigationTool = navigationTools->GetTool(i);
58  toolCorrespondencesInToolStorage->push_back(i);
59  bool toolAddSuccess = thisDevice->AddTool(thisNavigationTool->GetToolName().c_str());
60  if (!toolAddSuccess)
61  {
62  //todo error handling
63  errorMessage->append("Can't add tool, is the toolfile valid?");
64  return NULL;
65  }
66  }
67  returnValue->SetTrackingDevice(thisDevice);
68  return returnValue;
69  }
70 }
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< TrackingDeviceData > m_TrackingDeviceData
virtual 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.