19 #include "mitkIGTHardwareException.h"
69 std::string* errorMessage,
70 std::vector<int>* toolCorrespondencesInToolStorage)
72 MITK_DEBUG <<
"Creating Aurora tracking device.";
83 errorMessage->append(
"Hardware error on opening the connection (");
84 errorMessage->append(e.GetDescription());
85 errorMessage->append(
")");
90 errorMessage->append(
"Error on opening the connection (");
91 errorMessage->append(e.GetDescription());
92 errorMessage->append(
")");
98 std::vector<int> alreadyFoundTools = std::vector<int>();
99 *toolCorrespondencesInToolStorage = std::vector<int>();
100 for (
unsigned int i = 0; i < thisDevice->GetToolCount(); i++)
102 bool toolFound =
false;
103 for (
int j = 0; j < navigationTools->GetToolCount(); j++)
106 if ((dynamic_cast<mitk::NDIPassiveTool*>(thisDevice->GetTool(i)))->GetSerialNumber() == navigationTools->GetTool(j)->GetSerialNumber())
109 bool toolAlreadyAdded =
false;
110 for (
unsigned int k = 0; k < alreadyFoundTools.size(); k++)
if (alreadyFoundTools.at(k) == j) toolAlreadyAdded =
true;
112 if (!toolAlreadyAdded)
115 newToolStorageInRightOrder->AddTool(navigationTools->GetTool(j));
116 toolCorrespondencesInToolStorage->push_back(j);
118 dynamic_cast<mitk::NDIPassiveTool*
>(thisDevice->GetTool(i))->SetToolName(navigationTools->GetTool(j)->GetToolName());
120 dynamic_cast<mitk::NDIPassiveTool*
>(thisDevice->GetTool(i))->SetToolTip(navigationTools->GetTool(j)->GetToolTipPosition(), navigationTools->GetTool(j)->GetToolTipOrientation());
122 alreadyFoundTools.push_back(j);
131 errorMessage->append(
"Error: did not find every automatically detected tool in the loaded tool storage: aborting initialization.");
137 navigationTools->DeleteAllTools();
140 for (
int i = 0; i < newToolStorageInRightOrder->GetToolCount(); i++)
142 navigationTools->AddTool(newToolStorageInRightOrder->GetTool(i));
144 returnValue->SetTrackingDevice(thisDevice);
145 MITK_DEBUG <<
"Number of tools of created tracking device: " << thisDevice->GetToolCount();
146 MITK_DEBUG <<
"Number of outputs of created source: " << returnValue->GetNumberOfOutputs();
An object of this class represents an exception of the MITK-IGT module which are releated to the hard...
itk::SmartPointer< Self > Pointer
virtual bool OpenConnection() override
Set the type of the NDI Tracking Device because it can not jet handle this itself.
An object of this class represents an exception of the MITK-IGT module.
DataCollection - Class to facilitate loading/accessing structured data.
superclass for specific NDI tracking Devices that use serial communication.