diff --git a/Modules/US/USModel/mitkUSProbe.cpp b/Modules/US/USModel/mitkUSProbe.cpp index f36b772149..744bed24ef 100644 --- a/Modules/US/USModel/mitkUSProbe.cpp +++ b/Modules/US/USModel/mitkUSProbe.cpp @@ -1,40 +1,83 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkUSProbe.h" #include - mitk::USProbe::USProbe() : itk::Object() { - } mitk::USProbe::USProbe(std::string identifier) - : m_Name(identifier) + : m_Name(identifier) { } mitk::USProbe::~USProbe() { - } bool mitk::USProbe::IsEqualToProbe(mitk::USProbe::Pointer probe) { - if(m_Name.compare(probe->GetName()) == 0) return true; + if (m_Name.compare(probe->GetName()) == 0) return true; else return false; } + +void mitk::USProbe::SetDepthAndSpacing(int depth, mitk::Vector3D spacing) +{ + m_DepthsAndSpacings.insert(std::pair(depth, spacing)); +} + +std::map mitk::USProbe::GetDepthsAndSpacing() +{ + return m_DepthsAndSpacings; +} + +void mitk::USProbe::SetDepth(int depth) +{ + mitk::Vector3D defaultSpacing; + defaultSpacing[0] = 1; + defaultSpacing[1] = 1; + defaultSpacing[2] = 0; + + m_DepthsAndSpacings.insert(std::pair(depth, defaultSpacing)); +} + +void mitk::USProbe::SetSpacingForGivenDepth(int givenDepth, Vector3D spacing) +{ + m_DepthsAndSpacings[givenDepth][0] = spacing[0]; + m_DepthsAndSpacings[givenDepth][1] = spacing[1]; + m_DepthsAndSpacings[givenDepth][2] = spacing[2]; +} + +mitk::Vector3D mitk::USProbe::GetSpacingForGivenDepth(int givenDepth) +{ + mitk::Vector3D spacing; + std::map::iterator it = m_DepthsAndSpacings.find(givenDepth); + if (it != m_DepthsAndSpacings.end()) //check if given depth really exists + { + spacing[0] = it->second[0]; + spacing[1] = it->second[1]; + spacing[2] = it->second[2]; + } + else + { + spacing[0] = 1; + spacing[1] = 1; + spacing[2] = 0; + } + return spacing; +} diff --git a/Modules/US/USModel/mitkUSProbe.h b/Modules/US/USModel/mitkUSProbe.h index 27d77baaad..04b2b898b0 100644 --- a/Modules/US/USModel/mitkUSProbe.h +++ b/Modules/US/USModel/mitkUSProbe.h @@ -1,66 +1,91 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ - #ifndef MITKUSProbe_H_HEADER_INCLUDED_ #define MITKUSProbe_H_HEADER_INCLUDED_ #include #include #include #include +#include namespace mitk { - - /**Documentation - * \brief Right now, the US Probe is only a fancy name for a string. Later, it could handle probe specific parameters - * like the current frequency etc. It is able to compare itself to other probes for device managment though. - * - * \ingroup US - */ - //Be sure to check the isEqualTo() method if you expand this class to see if it needs work! + /**Documentation + * \brief Right now, the US Probe is only a fancy name for a string. Later, it could handle probe specific parameters + * like the current frequency etc. It is able to compare itself to other probes for device managment though. + * + * \ingroup US + */ + //Be sure to check the isEqualTo() method if you expand this class to see if it needs work! class MITKUS_EXPORT USProbe : public itk::Object - { - public: - mitkClassMacroItkParent(USProbe,itk::Object); - itkFactorylessNewMacro(Self) + { + public: + mitkClassMacroItkParent(USProbe, itk::Object); + itkFactorylessNewMacro(Self) itkCloneMacro(Self) mitkNewMacro1Param(Self, std::string); - /** - * \brief Compares this probe to another probe and returns true if they are equal in terms of name AND NAME ONLY - * be sure to sufficiently extend this method along with further capabilities probes. - */ - bool IsEqualToProbe(mitk::USProbe::Pointer probe); + /** + * \brief Compares this probe to another probe and returns true if they are equal in terms of name AND NAME ONLY + * be sure to sufficiently extend this method along with further capabilities probes. + */ + bool IsEqualToProbe(mitk::USProbe::Pointer probe); + /** + * \brief Sets a scanning depth of the probe and the associated spacing + */ + void SetDepthAndSpacing(int depth, Vector3D spacing); - //## getter and setter ## + /** + * \brief Gets all scanning depths and the associates spacings of the probe as an std::map with depth as key (represented by an int) and + *spacing as value (represented by a Vector3D) + */ + std::map GetDepthsAndSpacing(); - itkGetMacro(Name, std::string); - itkSetMacro(Name, std::string); + /** + * \brief Sets a scanning depth of the probe with the default spacing (1,1,0). Exact spacing needs to be calibrated. + */ + void SetDepth(int depth); + + /** + * \ brief Sets the spacing associated to the given depth of the probe. Spacing needs to be calibrated. + */ + void SetSpacingForGivenDepth(int givenDepth, Vector3D spacing); + + /** + * \brief Returns the spacing that is associated to the given depth of the probe. + *If spacing was not calibrated or if depth does not exist for this probe the default spacing (1,1,0) is returned. + */ + Vector3D GetSpacingForGivenDepth(int givenDepth); - protected: - USProbe(); - USProbe(std::string identifier); - virtual ~USProbe(); + //## getter and setter ## - std::string m_Name; + itkGetMacro(Name, std::string); + itkSetMacro(Name, std::string); + protected: + USProbe(); + USProbe(std::string identifier); + virtual ~USProbe(); + std::string m_Name; - }; + // Map containing the depths and the associated spacings as an std::vector with depth as key and spacing as value + std::map m_DepthsAndSpacings; + }; } // namespace mitk #endif