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
mitkUSProbe.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 "mitkUSProbe.h"
18 #include <string>
19 
21 {
22 }
23 
24 mitk::USProbe::USProbe(std::string identifier)
25  : m_Name(identifier)
26 {
27 }
28 
30 {
31 }
32 
34 {
35  if (m_Name.compare(probe->GetName()) == 0) return true;
36  else return false;
37 }
38 
40 {
41  m_DepthsAndSpacings.insert(std::pair<int, mitk::Vector3D>(depth, spacing));
42 }
43 
44 std::map<int, mitk::Vector3D> mitk::USProbe::GetDepthsAndSpacing()
45 {
46  return m_DepthsAndSpacings;
47 }
48 
49 void mitk::USProbe::SetDepth(int depth)
50 {
51  mitk::Vector3D defaultSpacing;
52  defaultSpacing[0] = 1;
53  defaultSpacing[1] = 1;
54  defaultSpacing[2] = 0;
55 
56  m_DepthsAndSpacings.insert(std::pair<int, mitk::Vector3D>(depth, defaultSpacing));
57 }
58 
59 void mitk::USProbe::RemoveDepth(int depthToRemove)
60 {
61  m_DepthsAndSpacings.erase(depthToRemove);
62 }
63 
64 void mitk::USProbe::SetSpacingForGivenDepth(int givenDepth, Vector3D spacing)
65 {
66  m_DepthsAndSpacings[givenDepth][0] = spacing[0];
67  m_DepthsAndSpacings[givenDepth][1] = spacing[1];
68  m_DepthsAndSpacings[givenDepth][2] = spacing[2];
69 }
70 
72 {
73  mitk::Vector3D spacing;
74  std::map<int, mitk::Vector3D>::iterator it = m_DepthsAndSpacings.find(givenDepth);
75  if (it != m_DepthsAndSpacings.end()) //check if given depth really exists
76  {
77  spacing[0] = it->second[0];
78  spacing[1] = it->second[1];
79  spacing[2] = it->second[2];
80  }
81  else
82  { //spacing does not exist, so set default spacing (1,1,0)
83  spacing[0] = 1;
84  spacing[1] = 1;
85  spacing[2] = 0;
86  }
87  return spacing;
88 }
itk::SmartPointer< Self > Pointer
std::map< int, Vector3D > GetDepthsAndSpacing()
Gets all scanning depths and the associates spacings of the probe as an std::map with depth as key (r...
Definition: mitkUSProbe.cpp:44
bool IsEqualToProbe(mitk::USProbe::Pointer probe)
Compares this probe to another probe and returns true if they are equal in terms of name AND NAME ONL...
Definition: mitkUSProbe.cpp:33
virtual ~USProbe()
Definition: mitkUSProbe.cpp:29
Vector3D GetSpacingForGivenDepth(int givenDepth)
Returns the spacing that is associated to the given depth of the probe. If spacing was not calibrated...
Definition: mitkUSProbe.cpp:71
void SetSpacingForGivenDepth(int givenDepth, Vector3D spacing)
Definition: mitkUSProbe.cpp:64
void SetDepthAndSpacing(int depth, Vector3D spacing)
Sets a scanning depth of the probe and the associated spacing.
Definition: mitkUSProbe.cpp:39
void SetDepth(int depth)
Sets a scanning depth of the probe with the default spacing (1,1,0). Exact spacing needs to be calibr...
Definition: mitkUSProbe.cpp:49
void RemoveDepth(int depthToRemove)
Removes the given depth of the probe, if it exists.
Definition: mitkUSProbe.cpp:59