Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
Medical Imaging Interaction Toolkit
mitkPolhemusTrackerTypeInformation.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 "Polhemus tracker";
22  }
23 
25  {
26  TrackingDeviceData data = { PolhemusTrackerTypeInformation::GetTrackingDeviceName(), "Polhemus Liberty Tracker", "cube", "X" };
27  return data;
28  }
29 
31  {
34  }
35 
37  {
38  }
39 
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::PolhemusTrackingDevice::Pointer thisDevice = dynamic_cast<mitk::PolhemusTrackingDevice*>(trackingDevice.GetPointer());
48  *toolCorrespondencesInToolStorage = std::vector<int>();
49  //add the tools to the tracking device
50  for (unsigned int i = 0; i < navigationTools->GetToolCount(); i++)
51  {
52  mitk::NavigationTool::Pointer thisNavigationTool = navigationTools->GetTool(i);
53  toolCorrespondencesInToolStorage->push_back(i);
54  bool toolAddSuccess = thisDevice->AddTool(thisNavigationTool->GetToolName().c_str(), std::stoi(thisNavigationTool->GetIdentifier()));
55  if (!toolAddSuccess)
56  {
57  //todo error handling
58  errorMessage->append("Can't add tool, is the toolfile valid?");
59  return NULL;
60  }
61  thisDevice->GetTool(i)->SetToolTipPosition(thisNavigationTool->GetToolTipPosition(), thisNavigationTool->GetToolAxisOrientation());
62  }
63  returnValue->SetTrackingDevice(thisDevice);
64  return returnValue;
65  }
66 }
An object of this class represents Polhemus tracking device. You can add tools to this device...
DataCollection - Class to facilitate loading/accessing structured data.
virtual TrackingDeviceSource::Pointer CreateTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools, std::string *errorMessage, std::vector< int > *toolCorrespondencesInToolStorage) override
std::vector< TrackingDeviceData > m_TrackingDeviceData