15 #include "mitkIGTHardwareException.h" 63 mitk::TrackingDevice::Pointer trackingDevice,
64 mitk::NavigationToolStorage::Pointer navigationTools,
65 std::string* errorMessage,
66 std::vector<int>* toolCorrespondencesInToolStorage)
68 MITK_DEBUG <<
"Creating Aurora tracking device.";
70 mitk::NDITrackingDevice::Pointer thisDevice =
dynamic_cast<mitk::NDITrackingDevice*
>(trackingDevice.GetPointer());
79 errorMessage->append(
"Hardware error on opening the connection (");
80 errorMessage->append(e.GetDescription());
81 errorMessage->append(
")");
86 errorMessage->append(
"Error on opening the connection (");
87 errorMessage->append(e.GetDescription());
88 errorMessage->append(
")");
94 std::vector<unsigned int> alreadyFoundTools = std::vector<unsigned int>();
95 *toolCorrespondencesInToolStorage = std::vector<int>();
96 for (
unsigned int i = 0; i < thisDevice->GetToolCount(); i++)
98 bool toolFound =
false;
99 for (
unsigned int j = 0; j < navigationTools->GetToolCount(); j++)
102 if ((dynamic_cast<mitk::NDIPassiveTool*>(thisDevice->GetTool(i)))->GetSerialNumber() == navigationTools->GetTool(j)->GetSerialNumber())
105 bool toolAlreadyAdded =
false;
106 for (
unsigned int k = 0;
k < alreadyFoundTools.size();
k++)
108 if (alreadyFoundTools.at(
k) == j)
110 toolAlreadyAdded =
true;
114 if (!toolAlreadyAdded)
117 newToolStorageInRightOrder->AddTool(navigationTools->GetTool(j));
118 toolCorrespondencesInToolStorage->push_back(j);
120 dynamic_cast<mitk::NDIPassiveTool*
>(thisDevice->GetTool(i))->SetToolName(navigationTools->GetTool(j)->GetToolName());
122 dynamic_cast<mitk::NDIPassiveTool*
>(thisDevice->GetTool(i))->SetToolTipPosition(navigationTools->GetTool(j)->GetToolTipPosition(), navigationTools->GetTool(j)->GetToolAxisOrientation());
124 alreadyFoundTools.push_back(j);
133 errorMessage->append(
"Error: did not find every automatically detected tool in the loaded tool storage: aborting initialization.");
139 for (
unsigned int i = 0; i < newToolStorageInRightOrder->GetToolCount(); i++)
141 navigationTools->AssignToolNumber(newToolStorageInRightOrder->GetTool(i)->GetIdentifier(), 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...
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.