Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkClaronTool.cpp
Go to the documentation of this file.
1
/*============================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center (DKFZ)
6
All rights reserved.
7
8
Use of this source code is governed by a 3-clause BSD license that can be
9
found in the LICENSE file.
10
11
============================================================================*/
12
13
#include "
mitkClaronTool.h
"
14
#include <cstdio>
15
#include <vector>
16
#include <iostream>
17
18
mitk::ClaronTool::ClaronTool
() :
TrackingTool
()
19
{
20
}
21
22
mitk::ClaronTool::~ClaronTool
(
void
)
23
{
24
}
25
26
std::string
mitk::ClaronTool::GetCalibrationName
()
27
{
28
return
&
m_CalibrationName
[0];
29
}
30
31
void
mitk::ClaronTool::SetCalibrationName
(std::string name)
32
{
33
this->
m_CalibrationName
=name;
34
}
35
36
bool
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
48
bool
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
87
std::string
mitk::ClaronTool::GetFile
()
88
{
89
return
m_Filename
;
90
}
91
92
void
mitk::ClaronTool::SetToolHandle
(
mitk::claronToolHandle
handle)
93
{
94
this->
m_ToolHandle
= handle;
95
}
96
97
mitk::claronToolHandle
mitk::ClaronTool::GetToolHandle
()
98
{
99
return
this->
m_ToolHandle
;
100
}
mitk::TrackingTool
Interface for all Tracking Tools.
Definition:
mitkTrackingTool.h:42
mitk::claronToolHandle
int claronToolHandle
Definition:
mitkClaronInterface.h:34
mitk::ClaronTool::m_CalibrationName
std::string m_CalibrationName
Variable which holds the Tool's calibration name.
Definition:
mitkClaronTool.h:77
mitk::ClaronTool::m_Filename
std::string m_Filename
Variable to check filename's format and to get back complete filename.
Definition:
mitkClaronTool.h:79
mitk::ClaronTool::~ClaronTool
~ClaronTool() override
Definition:
mitkClaronTool.cpp:22
mitk::ClaronTool::SetCalibrationName
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...
Definition:
mitkClaronTool.cpp:31
mitk::ClaronTool::GetFile
std::string GetFile()
Definition:
mitkClaronTool.cpp:87
mitkClaronTool.h
mitk::ClaronTool::GetToolHandle
claronToolHandle GetToolHandle()
Definition:
mitkClaronTool.cpp:97
mitk::ClaronTool::m_ToolHandle
claronToolHandle m_ToolHandle
Tool handle variable from tracking device.
Definition:
mitkClaronTool.h:75
mitk::ClaronTool::LoadFile
bool LoadFile(const char *filename)
Loads a tool calibration file. Without this file the tool can not be tracked!
Definition:
mitkClaronTool.cpp:36
mitk::ClaronTool::ClaronTool
ClaronTool()
Definition:
mitkClaronTool.cpp:18
mitk::ClaronTool::SetToolHandle
void SetToolHandle(claronToolHandle handle)
Sets the handle of the tool.
Definition:
mitkClaronTool.cpp:92
mitk::ClaronTool::GetCalibrationName
std::string GetCalibrationName()
Definition:
mitkClaronTool.cpp:26
Source
Modules
IGT
TrackingDevices
mitkClaronTool.cpp
Generated on Thu Mar 12 2020 10:23:40 for Medical Imaging Interaction Toolkit by
1.8.13