15 #include "mitkIGTConfig.h" 17 #include "mitkIGTHardwareException.h" 18 #include <itksys/SystemTools.hxx> 20 #include <itkMutexLockHolder.h> 37 if (
m_Device->IsMicronTrackerInstalled())
40 #ifdef MITK_MICRON_TRACKER_CALIBRATION_DIR 56 return tempInterface->IsMicronTrackerInstalled();
68 if (t->LoadFile(fileName) ==
false)
72 t->SetToolName(toolName);
75 return t.GetPointer();
88 std::vector<mitk::ClaronTool::Pointer> returnValue;
89 std::vector<claronToolHandle> allHandles =
m_Device->GetAllActiveTools();
90 for (
auto iter = allHandles.begin(); iter != allHandles.end(); ++iter)
93 newTool->SetToolName(
m_Device->GetName(*iter));
94 newTool->SetCalibrationName(
m_Device->GetName(*iter));
95 newTool->SetToolHandle(*iter);
96 returnValue.push_back(newTool);
106 if (!
m_Device->IsMicronTrackerInstalled())
115 for (
unsigned int i=0; i<
m_AllTools.size(); i++)
141 Superclass::StopTracking();
170 returnValue =
m_Device->StartTracking();
194 bool returnValue =
true;
198 returnValue =
m_Device->StopTracking();
227 bool localStopTracking;
236 std::vector<mitk::ClaronTool::Pointer> detectedTools = this->
DetectTools();
237 std::vector<mitk::ClaronTool::Pointer> allTools = this->
GetAllTools();
238 std::vector<mitk::ClaronTool::Pointer>::iterator itAllTools;
239 for(itAllTools = allTools.begin(); itAllTools != allTools.end(); itAllTools++)
241 mitk::ClaronTool::Pointer currentTool = *itAllTools;
243 std::vector<mitk::ClaronTool::Pointer>::iterator itDetectedTools;
244 bool foundTool =
false;
245 for(itDetectedTools = detectedTools.begin(); itDetectedTools != detectedTools.end(); itDetectedTools++)
247 mitk::ClaronTool::Pointer aktuDet = *itDetectedTools;
248 std::string tempString(currentTool->GetCalibrationName());
249 if (tempString.compare(aktuDet->GetCalibrationName())==0)
251 currentTool->SetToolHandle(aktuDet->GetToolHandle());
257 currentTool->SetToolHandle(0);
260 if (currentTool->GetToolHandle() != 0)
262 currentTool->SetDataValid(
true);
267 pos[0] = pos_vector[0];
268 pos[1] = pos_vector[1];
269 pos[2] = pos_vector[2];
270 currentTool->SetPosition(pos);
275 currentTool->SetOrientation(orientation);
284 currentTool->SetPosition(origin);
286 currentTool->SetDataValid(
false);
305 return this->
m_Device->IsMicronTrackerInstalled();
312 struct itk::MultiThreader::ThreadInfoStruct * pInfo = (
struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
313 if (pInfo ==
nullptr)
315 return ITK_THREAD_RETURN_VALUE;
317 if (pInfo->UserData ==
nullptr)
319 return ITK_THREAD_RETURN_VALUE;
323 if (trackingDevice !=
nullptr)
326 return ITK_THREAD_RETURN_VALUE;
itk::MultiThreader::Pointer m_MultiThreader
An object of this class represents an exception of the MITK-IGT module which are releated to the hard...
std::string m_ToolfilesDir
The directory where the tool calibration files can be found.
itk::FastMutexLock::Pointer m_TrackingFinishedMutex
mutex to manage control flow of StopTracking()
std::vector< double > GetTipPosition(claronToolHandle c)
std::vector< ClaronTool::Pointer > DetectTools()
Automatically detects tools in field of measurement of the tracking device. Tools can only be detecte...
std::vector< double > GetTipQuaternions(claronToolHandle c)
bool IsDeviceInstalled() override
ClaronInterface * GetDevice()
An object of this class represents the interface to the MicronTracker. The methods of this class are ...
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< ClaronTool::Pointer > m_AllTools
vector holding all tools
~ClaronTrackingDevice() override
std::vector< ClaronTool::Pointer > GetAllTools()
bool StartTracking() override
Starts the tracking.
TrackingDeviceState GetState() const
return current object state (Setup, Ready or Tracking)
mitk::TrackingTool * AddTool(const char *toolName, const char *fileName)
Create a new Claron tool with toolName and fileName and add it to the list of tools.
An object of this class represents the MicronTracker device. You can add tools to this device...
unsigned int GetToolCount() const override
bool StopTracking() override
Stops the tracking.
void GrabFrame()
Grabs a frame from the camera.
bool CloseConnection() override
Closes the connection and clears all resources.
bool OpenConnection() override
Opens the connection to the device. This have to be done before the tracking is started.
bool m_StopTracking
signal stop to tracking thread
Interface for all Tracking Devices.
static IGTTimeStamp * GetInstance()
returns a pointer to the current instance of mitkTimeStamp
vnl_quaternion< ScalarType > Quaternion
void Start(itk::Object::Pointer device)
starts the time-acquisition
bool InternalAddTool(ClaronTool::Pointer tool)
Adds a tool to the tracking device.
static ITK_THREAD_RETURN_TYPE ThreadStartTracking(void *data)
std::string m_CalibrationDir
The directory where the camera calibration files can be found.
static std::string CreateTemporaryDirectory(const std::string &templateName="XXXXXX", std::string path=std::string())
TrackingDeviceData m_Data
current device Data
#define mitkThrowException(classname)
bool IsMicronTrackerInstalled()
itk::FastMutexLock::Pointer m_StopTrackingMutex
mutex to control access to m_StopTracking
void TrackTools()
This method tracks tools as long as the variable m_Mode is set to "Tracking". Tracking tools means gr...
ClaronInterface::Pointer m_Device
represents the interface to the tracking hardware
void SetState(TrackingDeviceState state)
change object state
TrackingTool * GetTool(unsigned int toolNumber) const override
itk::MutexLockHolder< itk::FastMutexLock > MutexLockHolder