MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkNPOptitrackTrackingTypeInformation.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
16
17namespace mitk
18{
20 {
21 return "NP Optitrack";
22 }
23
29
35
39
41 TrackingDevice::Pointer trackingDevice,
42 NavigationToolStorage::Pointer navigationTools,
43 std::string* errorMessage,
44 std::vector<int>* toolCorrespondencesInToolStorage)
45 {
46 mitk::TrackingDeviceSource::Pointer returnValue = mitk::TrackingDeviceSource::New();
47 mitk::OptitrackTrackingDevice::Pointer thisDevice = dynamic_cast<mitk::OptitrackTrackingDevice*>(trackingDevice.GetPointer());
48 *toolCorrespondencesInToolStorage = std::vector<int>();
49
50 //OpenConnection with Optitrack
51 thisDevice->OpenConnection();
52
53 //add the tools to the tracking device
54 for (unsigned int i = 0; i < navigationTools->GetToolCount(); i++)
55 {
56 mitk::NavigationTool::Pointer thisNavigationTool = navigationTools->GetTool(i);
57 toolCorrespondencesInToolStorage->push_back(i);
58 bool toolAddSuccess = thisDevice->AddToolByDefinitionFile(thisNavigationTool->GetCalibrationFile());
59 thisDevice->GetOptitrackTool(i)->SetToolName(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 nullptr;
65 }
66 //thisDevice->GetTool(i)->SetToolTip(thisNavigationTool->GetToolTipPosition(),thisNavigationTool->GetToolAxisOrientation());
67 }
68 returnValue->SetTrackingDevice(thisDevice);
69 return returnValue;
70 }
71}
TrackingDeviceSource::Pointer CreateTrackingDeviceSource(TrackingDevice::Pointer trackingDevice, NavigationToolStorage::Pointer navigationTools, std::string *errorMessage, std::vector< int > *toolCorrespondencesInToolStorage) override
An object of this class represents the Optitrack device. You can add tools to this device,...
std::vector< TrackingDeviceData > m_TrackingDeviceData
IGT Exceptions.