Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkNPOptitrackTrackingTypeInformation.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 "NP Optitrack";
26  }
27 
29  {
31  return data;
32  }
33 
35  {
38  }
39 
41  {
42  }
43 
45  TrackingDevice::Pointer trackingDevice,
46  NavigationToolStorage::Pointer navigationTools,
47  std::string* errorMessage,
48  std::vector<int>* toolCorrespondencesInToolStorage)
49  {
51  mitk::OptitrackTrackingDevice::Pointer thisDevice = dynamic_cast<mitk::OptitrackTrackingDevice*>(trackingDevice.GetPointer());
52  *toolCorrespondencesInToolStorage = std::vector<int>();
53 
54  //OpenConnection with Optitrack
55  thisDevice->OpenConnection();
56 
57  //add the tools to the tracking device
58  for (int i = 0; i < navigationTools->GetToolCount(); i++)
59  {
60  mitk::NavigationTool::Pointer thisNavigationTool = navigationTools->GetTool(i);
61  toolCorrespondencesInToolStorage->push_back(i);
62  bool toolAddSuccess = thisDevice->AddToolByDefinitionFile(thisNavigationTool->GetCalibrationFile());
63  thisDevice->GetOptitrackTool(i)->SetToolName(thisNavigationTool->GetToolName().c_str());
64  if (!toolAddSuccess)
65  {
66  //todo error handling
67  errorMessage->append("Can't add tool, is the toolfile valid?");
68  return NULL;
69  }
70  //thisDevice->GetTool(i)->SetToolTip(thisNavigationTool->GetToolTipPosition(),thisNavigationTool->GetToolTipOrientation());
71  }
72  returnValue->SetTrackingDevice(thisDevice);
73  return returnValue;
74  }
75 }
virtual TrackingDeviceSource::Pointer CreateTrackingDeviceSource(TrackingDevice::Pointer trackingDevice, NavigationToolStorage::Pointer navigationTools, std::string *errorMessage, std::vector< int > *toolCorrespondencesInToolStorage) override
itk::SmartPointer< Self > Pointer
An object of this class represents the Optitrack device. You can add tools to this device...
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< TrackingDeviceData > m_TrackingDeviceData