25 #include <mitkIGTException.h>
26 #include <mitkIGTHardwareException.h>
38 if (NavigationTools.IsNotNull())
41 for (
int i=0; i<NavigationTools->GetToolCount(); i++)
54 return m_NavigationTools;
64 if (m_NavigationTools.IsNull())
66 m_ErrorMessage =
"NavigationToolStorage is NULL!";
69 else if (m_TrackingDevice.IsNull())
71 m_ErrorMessage =
"TrackingDevice is NULL!";
76 for (
int i=0; i<m_NavigationTools->GetToolCount(); i++)
78 if (m_NavigationTools->GetTool(i)->GetTrackingDeviceType() != m_TrackingDevice->GetType())
80 m_ErrorMessage =
"At least one tool is not of the same type like the tracking device.";
92 return this->CreateTrackingDeviceSource(dummy);
97 if (!this->IsCreateTrackingDeviceSourcePossible()) {
MITK_WARN <<
"Cannot create tracking decive: " << m_ErrorMessage;
return NULL;}
107 MITK_ERROR <<
"No tracking device service found!";
114 CreateTrackingDeviceSource(m_TrackingDevice,m_NavigationTools, &m_ErrorMessage, &m_ToolCorrespondencesInToolStorage);
117 if (returnValue.IsNull()) {
MITK_WARN <<
"Cannot create tracking decive: " << m_ErrorMessage;
return NULL;}
120 visualizationFilter = CreateNavigationDataObjectVisualizationFilter(returnValue,m_NavigationTools);
121 if (visualizationFilter.IsNull()) {
MITK_WARN <<
"Cannot create tracking decive: " << m_ErrorMessage;
return NULL;}
128 return this->m_ErrorMessage;
136 for (
unsigned int i=0; i<trackingDeviceSource->GetNumberOfIndexedOutputs(); i++)
141 if (currentTool.IsNull())
143 this->m_ErrorMessage =
"Error: did not find corresponding tool in tracking device after initialization.";
146 returnValue->SetInput(i,trackingDeviceSource->GetOutput(i));
147 returnValue->SetRepresentationObject(i,currentTool->GetDataNode()->GetData());
154 if (outputID < m_ToolCorrespondencesInToolStorage.size())
return m_ToolCorrespondencesInToolStorage.at(outputID);
160 if (outputID < m_ToolCorrespondencesInToolStorage.size())
return m_NavigationTools->GetTool(m_ToolCorrespondencesInToolStorage.at(outputID))->GetIdentifier();
166 return m_ToolCorrespondencesInToolStorage;
171 std::vector<std::string> returnValue = std::vector<std::string>();
172 for (
unsigned int i=0; i<m_ToolCorrespondencesInToolStorage.size(); i++)
173 {returnValue.push_back(m_NavigationTools->GetTool(m_ToolCorrespondencesInToolStorage.at(i))->GetIdentifier());}
itk::SmartPointer< Self > Pointer
mitk::TrackingDeviceSource::Pointer CreateTrackingDeviceSource()
std::vector< std::string > GetToolIdentifiersInToolStorage()
std::string GetToolIdentifierInToolStorage(unsigned int outputID)
This class is a collection for information of all Tracking Device Types (derived from abstract Tracki...
mitk::NavigationToolStorage::Pointer GetUpdatedNavigationToolStorage()
std::vector< int > m_ToolCorrespondencesInToolStorage
virtual ~TrackingDeviceSourceConfigurator()
TrackingDeviceTypeInformation * GetTrackingDeviceTypeInformation(TrackingDeviceType type)
std::string GetErrorMessage()
TrackingDeviceSourceConfigurator(mitk::NavigationToolStorage::Pointer NavigationTools, mitk::TrackingDevice::Pointer TrackingDevice)
mitk::NavigationDataObjectVisualizationFilter::Pointer CreateNavigationDataObjectVisualizationFilter(mitk::TrackingDeviceSource::Pointer trackingDeviceSource, mitk::NavigationToolStorage::Pointer navigationTools)
Interface for all Tracking Devices.
bool IsCreateTrackingDeviceSourcePossible()
std::string m_ErrorMessage
int GetToolNumberInToolStorage(unsigned int outputID)
mitk::TrackingDevice::Pointer m_TrackingDevice
mitk::NavigationToolStorage::Pointer m_NavigationTools
std::vector< int > GetToolNumbersInToolStorage()
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.