Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
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 (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 "mitkUSProbe.h"
14 #include <string>
15 
16 mitk::USProbe::USProbe() : itk::Object(), m_CurrentDepth(0)
17 {
18 }
19 
20 mitk::USProbe::USProbe(std::string identifier)
21  : m_Name(identifier), m_CurrentDepth(0)
22 {
23 }
24 
26 {
27 }
28 
29 void mitk::USProbe::SetProbeCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
30 {
31  m_Cropping.top = top;
32  m_Cropping.bottom = bottom;
33  m_Cropping.left = left;
34  m_Cropping.right = right;
35 }
36 
38 {
39  return m_Cropping;
40 }
41 
42 bool mitk::USProbe::IsEqualToProbe(mitk::USProbe::Pointer probe)
43 {
44  if (m_Name.compare(probe->GetName()) == 0) return true;
45  else return false;
46 }
47 
49 {
50  m_DepthsAndSpacings.insert(std::pair<int, mitk::Vector3D>(depth, spacing));
51 }
52 
53 std::map<int, mitk::Vector3D> mitk::USProbe::GetDepthsAndSpacing()
54 {
55  return m_DepthsAndSpacings;
56 }
57 
58 void mitk::USProbe::SetDepth(int depth)
59 {
60  mitk::Vector3D defaultSpacing;
61  defaultSpacing[0] = 1;
62  defaultSpacing[1] = 1;
63  defaultSpacing[2] = 1;
64 
65  m_DepthsAndSpacings.insert(std::pair<int, mitk::Vector3D>(depth, defaultSpacing));
66 }
67 
68 void mitk::USProbe::RemoveDepth(int depthToRemove)
69 {
70  m_DepthsAndSpacings.erase(depthToRemove);
71 }
72 
73 void mitk::USProbe::SetSpacingForGivenDepth(int givenDepth, Vector3D spacing)
74 {
75  m_DepthsAndSpacings[givenDepth][0] = spacing[0];
76  m_DepthsAndSpacings[givenDepth][1] = spacing[1];
77  m_DepthsAndSpacings[givenDepth][2] = spacing[2];
78 }
79 
81 {
82  mitk::Vector3D spacing;
83  std::map<int, mitk::Vector3D>::iterator it = m_DepthsAndSpacings.find(givenDepth);
84  if (it != m_DepthsAndSpacings.end()) //check if given depth really exists
85  {
86  spacing[0] = it->second[0];
87  spacing[1] = it->second[1];
88  spacing[2] = it->second[2];
89  }
90  else
91  { //spacing does not exist, so set default spacing (1,1,1)
92  spacing[0] = 1;
93  spacing[1] = 1;
94  spacing[2] = 1;
95  }
96  return spacing;
97 }
98 
100 {
101  if( m_DepthsAndSpacings.size() == 0 )
102  {
103  return true;
104  }
105 
106  return false;
107 }
double m_CurrentDepth
Definition: mitkUSProbe.h:118
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:53
USProbeCropping GetProbeCropping()
Definition: mitkUSProbe.cpp:37
bool IsDepthAndSpacingEmpty()
Checks, whether the std::map m_DepthAndSpacings contains at least one depth element or not...
Definition: mitkUSProbe.cpp:99
std::map< int, Vector3D > m_DepthsAndSpacings
Definition: mitkUSProbe.h:121
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:42
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:80
void SetSpacingForGivenDepth(int givenDepth, Vector3D spacing)
Definition: mitkUSProbe.cpp:73
void SetProbeCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
Sets the probe cropping.
Definition: mitkUSProbe.cpp:29
USProbeCropping m_Cropping
Definition: mitkUSProbe.h:123
void SetDepthAndSpacing(int depth, Vector3D spacing)
Sets a scanning depth of the probe and the associated spacing.
Definition: mitkUSProbe.cpp:48
void SetDepth(int depth)
Sets a scanning depth of the probe with the default spacing (1,1,1). Exact spacing needs to be calibr...
Definition: mitkUSProbe.cpp:58
void RemoveDepth(int depthToRemove)
Removes the given depth of the probe, if it exists.
Definition: mitkUSProbe.cpp:68
std::string m_Name
Definition: mitkUSProbe.h:117
Struct to define a probe specific ultrasound image cropping.
Definition: mitkUSProbe.h:41
~USProbe() override
Definition: mitkUSProbe.cpp:25