Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkClaronTool.h"
18 #include <stdio.h>
19 #include <vector>
20 #include <iostream>
21 
23 {
24 }
25 
27 {
28 }
29 
31 {
32  return &m_CalibrationName[0];
33 }
34 
36 {
37  this->m_CalibrationName=name;
38 }
39 
41 {
42  if (filename==nullptr)
43  {
44  return false;
45  }
46  else
47  {
48  return this->LoadFile(std::string(filename));
49  }
50 }
51 
53 {
54  //This method is not really "loading" a file. It is saving the filename and
55  //parsing the calibration name out of the filename. The calibration name is
56  //later used by the tracking device to really load the file.
57 
58  if (filename.empty())
59  {
60  return false;
61  }
62  else
63  {
64  m_Filename = filename;
65 
66  int end = m_Filename.length();
67  int start = end;
68 
69  //check whether the path is given in Windows format
70  while( (start!=0) && (filename[start-1]!='\\') ) start--;
71 
72  //if not (start==0) perhaps it is given in Linux format
73  if (start==0)
74  {
75  start = end;
76  while( (start!=0) && (filename[start-1]!='/') )
77  {
78  start--;
79  }
80  }
81 
82  //if there are no \ and no / in the string something must be wrong...
83  if (start==0) return false;
84 
85  this->m_CalibrationName = m_Filename.substr(start,end);
86 
87  return true;
88  }
89 }
90 
92 {
93  return m_Filename;
94 }
95 
97 {
98  this->m_ToolHandle = handle;
99 }
100 
102 {
103  return this->m_ToolHandle;
104 }
int claronToolHandle
implements TrackingTool interface
static const std::string filename
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...
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()