diff --git a/Modules/IGT/IGTTrackingDevices/mitkTrackingTool.h b/Modules/IGT/IGTTrackingDevices/mitkTrackingTool.h index e94fbcdf74..5e855db02c 100644 --- a/Modules/IGT/IGTTrackingDevices/mitkTrackingTool.h +++ b/Modules/IGT/IGTTrackingDevices/mitkTrackingTool.h @@ -1,61 +1,61 @@ /*=================================================================== 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 MITKTRACKINGTOOL_H_HEADER_INCLUDED_ #define MITKTRACKINGTOOL_H_HEADER_INCLUDED_ #include #include #include #include #include namespace mitk { /**Documentation * \brief Interface for all Tracking Tools * * Abstract class that defines the methods that are common for all tracking tools. * * \ingroup IGT */ class MitkIGT_EXPORT TrackingTool : public itk::Object { public: mitkClassMacro(TrackingTool, itk::Object); virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void SetToolTip(mitk::Point3D toolTipPosition, mitk::Quaternion orientation) = 0; ///< defines a tool tip for this tool in tool coordinates. GetPosition() and GetOrientation() return the data of the tool tip if it is defined. By default no tooltip is defined. + virtual void SetToolTip(mitk::Point3D toolTipPosition, mitk::Quaternion orientation, ScalarType eps=0.0) = 0; ///< defines a tool tip for this tool in tool coordinates. GetPosition() and GetOrientation() return the data of the tool tip if it is defined. By default no tooltip is defined. virtual void GetPosition(mitk::Point3D& position) const = 0; ///< returns the current position of the tool as an array of three floats (in the tracking device coordinate system) virtual void GetOrientation(mitk::Quaternion& orientation) const = 0; ///< returns the current orientation of the tool as a quaternion in a mitk::Point4D (in the tracking device coordinate system) virtual bool Enable() = 0; ///< enables the tool, so that it will be tracked virtual bool Disable() = 0; ///< disables the tool, so that it will not be tracked anymore virtual bool IsEnabled() const = 0; ///< returns whether the tool is enabled or disabled virtual bool IsDataValid() const = 0; ///< returns true if the current position data is valid (no error during tracking, tracking error below threshold, ...) virtual float GetTrackingError() const = 0; ///< returns one value that corresponds to the overall tracking error. virtual const char* GetToolName() const; ///< every tool has a name that can be used to identify it. virtual const char* GetErrorMessage() const; ///< if the data is not valid, ErrorMessage should contain a string explaining why it is invalid (the Set-method should be implemented in subclasses, it should not be accessible by the user) protected: TrackingTool(); virtual ~TrackingTool(); std::string m_ToolName; ///< every tool has a name that can be used to identify it. std::string m_ErrorMessage; ///< if a tool is invalid, this member should contain a human readable explanation of why it is invalid itk::FastMutexLock::Pointer m_MyMutex; ///< mutex to control concurrent access to the tool }; } // namespace mitk #endif /* MITKTRACKINGTOOL_H_HEADER_INCLUDED_ */ diff --git a/Modules/IGT/Testing/mitkTrackingToolTest.cpp b/Modules/IGT/Testing/mitkTrackingToolTest.cpp index 9c720ba50f..c56a751fa4 100644 --- a/Modules/IGT/Testing/mitkTrackingToolTest.cpp +++ b/Modules/IGT/Testing/mitkTrackingToolTest.cpp @@ -1,65 +1,65 @@ /*=================================================================== 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 "mitkTestingMacros.h" #include "mitkTrackingTool.h" #include "mitkTrackingTypes.h" #include "mitkCommon.h" #include #include /** * Create new class and derive it from TrackingDevice */ class TrackingToolTestClass : public mitk::TrackingTool { public: mitkClassMacro(TrackingToolTestClass, mitk::TrackingTool); itkNewMacro(Self); virtual void GetPosition(mitk::Point3D & /*position*/) const {}; virtual void GetOrientation(mitk::Quaternion& /*orientation*/) const {}; - virtual void SetToolTip(mitk::Point3D toolTipPosition, mitk::Quaternion orientation) {}; + virtual void SetToolTip(mitk::Point3D toolTipPosition, mitk::Quaternion orientation, mitk::ScalarType eps) {}; virtual bool Enable() {return true;} virtual bool Disable() {return true;} virtual bool IsEnabled() const {return true;} virtual bool IsDataValid() const {return true;} virtual float GetTrackingError() const {return 0.0;} }; /** * This function is testing the Class TrackingDevice. For most tests we would need the MicronTracker hardware, so only a few * simple tests, which can run without the hardware are implemented yet (2009, January, 23rd). As soon as there is a working * concept to test the tracking classes which are very close to the hardware on all systems more tests are needed here. */ int mitkTrackingToolTest(int /* argc */, char* /*argv*/[]) { MITK_TEST_BEGIN("TrackingTool"); // Test instantiation of TrackingTool TrackingToolTestClass::Pointer trackingToolTestClass = TrackingToolTestClass::New(); MITK_TEST_CONDITION(trackingToolTestClass.IsNotNull(),"Test instatiation"); // Test method GetToolName() MITK_TEST_CONDITION(!strcmp(trackingToolTestClass->GetToolName(),""),"Tool name should be empty"); // Test method GetErrorMessage() MITK_TEST_CONDITION(!strcmp(trackingToolTestClass->GetErrorMessage(),""),"Error message should be empty"); MITK_TEST_END(); }