MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkClaronTool.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
13#include "mitkClaronTool.h"
14#include <cstdio>
15#include <vector>
16#include <iostream>
17
18mitk::ClaronTool::ClaronTool() : TrackingTool()
19{
20}
21
25
27{
28 return &m_CalibrationName[0];
29}
30
32{
33 this->m_CalibrationName=name;
34}
35
36bool mitk::ClaronTool::LoadFile(const char* filename)
37{
38 if (filename==nullptr)
39 {
40 return false;
41 }
42 else
43 {
44 return this->LoadFile(std::string(filename));
45 }
46}
47
48bool mitk::ClaronTool::LoadFile(std::string filename)
49{
50 //This method is not really "loading" a file. It is saving the filename and
51 //parsing the calibration name out of the filename. The calibration name is
52 //later used by the tracking device to really load the file.
53
54 if (filename.empty())
55 {
56 return false;
57 }
58 else
59 {
60 m_Filename = filename;
61
62 int end = m_Filename.length();
63 int start = end;
64
65 //check whether the path is given in Windows format
66 while( (start!=0) && (filename[start-1]!='\\') ) start--;
67
68 //if not (start==0) perhaps it is given in Linux format
69 if (start==0)
70 {
71 start = end;
72 while( (start!=0) && (filename[start-1]!='/') )
73 {
74 start--;
75 }
76 }
77
78 //if there are no \ and no / in the string something must be wrong...
79 if (start==0) return false;
80
81 this->m_CalibrationName = m_Filename.substr(start,end);
82
83 return true;
84 }
85}
86
88{
89 return m_Filename;
90}
91
93{
94 this->m_ToolHandle = handle;
95}
96
98{
99 return this->m_ToolHandle;
100}
std::string GetFile()
claronToolHandle GetToolHandle()
bool LoadFile(const char *filename)
Loads a tool calibration file. Without this file the tool can not be tracked!
void SetToolHandle(claronToolHandle handle)
Sets the handle of the tool.
std::string GetCalibrationName()
void SetCalibrationName(std::string name)
Sets the calibration name of the tool. Be careful, only use this method if you know what you are doin...
int claronToolHandle