MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkUSProbe.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 "mitkUSProbe.h"
14#include <string>
15
16mitk::USProbe::USProbe() : itk::Object(), m_CurrentDepth(0)
17{
18}
19
20mitk::USProbe::USProbe(std::string identifier)
21 : m_Name(identifier), m_CurrentDepth(0)
22{
23}
24
28
29void 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
41
42bool mitk::USProbe::IsEqualToProbe(mitk::USProbe::Pointer probe)
43{
44 if (m_Name.compare(probe->GetName()) == 0) return true;
45 else return false;
46}
47
48void mitk::USProbe::SetDepthAndSpacing(int depth, mitk::Vector3D spacing)
49{
50 m_DepthsAndSpacings.insert(std::pair<int, mitk::Vector3D>(depth, spacing));
51}
52
53std::map<int, mitk::Vector3D> mitk::USProbe::GetDepthsAndSpacing()
54{
55 return m_DepthsAndSpacings;
56}
57
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
68void mitk::USProbe::RemoveDepth(int depthToRemove)
69{
70 m_DepthsAndSpacings.erase(depthToRemove);
71}
72
73void 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
80mitk::Vector3D mitk::USProbe::GetSpacingForGivenDepth(int givenDepth)
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}
void RemoveDepth(int depthToRemove)
Removes the given depth of the probe, if it exists.
bool IsDepthAndSpacingEmpty()
Checks, whether the std::map m_DepthAndSpacings contains at least one depth element or not.
void SetDepth(int depth)
Sets a scanning depth of the probe with the default spacing (1,1,1). Exact spacing needs to be calibr...
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...
Vector3D GetSpacingForGivenDepth(int givenDepth)
Returns the spacing that is associated to the given depth of the probe. If spacing was not calibrated...
~USProbe() override
void SetProbeCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
Sets the probe cropping.
void SetSpacingForGivenDepth(int givenDepth, Vector3D spacing)
void SetDepthAndSpacing(int depth, Vector3D spacing)
Sets a scanning depth of the probe and the associated spacing.
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...
USProbeCropping GetProbeCropping()
Struct to define a probe specific ultrasound image cropping.
Definition mitkUSProbe.h:42