Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkIGTLMessage.h
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 
14 #ifndef mitkIGTLMessage_h
15 #define mitkIGTLMessage_h
16 
17 #include <itkDataObject.h>
18 #include "MitkOpenIGTLinkExports.h"
19 #include <mitkNumericTypes.h>
20 #include <mitkCommon.h>
21 
22 #include "igtlMessageBase.h"
23 
24 namespace mitk {
25 
35  class MITKOPENIGTLINK_EXPORT IGTLMessage : public itk::DataObject
36  {
37  public:
38  mitkClassMacroItkParent(IGTLMessage, itk::DataObject);
39  itkFactorylessNewMacro(Self);
40  itkCloneMacro(Self);
41  mitkNewMacro1Param(Self, igtl::MessageBase::Pointer);
42 
46  typedef double TimeStampType;
47 
51  void SetMessage(igtl::MessageBase::Pointer msg);
55  itkGetConstMacro(Message, igtl::MessageBase::Pointer);
59  virtual bool IsDataValid() const;
64  itkSetMacro(DataValid, bool);
68  itkGetConstMacro(IGTTimeStamp, TimeStampType);
72  itkSetStringMacro(Name);
76  itkGetStringMacro(Name);
77 
88  void Graft(const DataObject *data) override;
89 
95  void CopyInformation(const DataObject* data) override;
96 
102  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
103 
104  std::string ToString() const;
105 
116  void Compose(const mitk::IGTLMessage::Pointer n, const bool pre = false);
117 
120  const char* GetIGTLMessageType() const;
121 
122  template < typename IGTLMessageType > IGTLMessageType* GetMessage() const;
123 
124  protected:
125  mitkCloneMacro(Self);
126 
127  IGTLMessage();
128 
132  IGTLMessage(const mitk::IGTLMessage& toCopy);
133 
137  IGTLMessage(igtl::MessageBase::Pointer message);
138 
139  ~IGTLMessage() override;
140 
144  igtl::MessageBase::Pointer m_Message;
145 
157  std::string m_Name;
158 
159  private:
160 
161  // pre = false
162  static mitk::IGTLMessage::Pointer getComposition(
163  const mitk::IGTLMessage::Pointer nd1,
164  const mitk::IGTLMessage::Pointer nd2);
165 
169  itkSetMacro(IGTTimeStamp, TimeStampType);
170 
171  };
172 
189  MITKOPENIGTLINK_EXPORT bool Equal( const mitk::IGTLMessage& leftHandSide,
190  const mitk::IGTLMessage& rightHandSide,
192  bool verbose = false );
193 
194 } // namespace mitk
195 #endif
mitk::eps
const MITKCORE_EXPORT ScalarType eps
mitk::IGTTimeStamp
Time stamp in milliseconds.
Definition: mitkIGTTimeStamp.h:48
mitk::IGTLMessage::m_DataValid
bool m_DataValid
defines if the object contains valid values
Definition: mitkIGTLMessage.h:149
mitk::IGTLMessage::m_Message
igtl::MessageBase::Pointer m_Message
holds the actual OpenIGTLink message
Definition: mitkIGTLMessage.h:144
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk::Equal
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
mitk::IGTLMessage::m_IGTTimeStamp
TimeStampType m_IGTTimeStamp
contains the time at which the tracking data was recorded
Definition: mitkIGTLMessage.h:153
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk::IGTLMessage
A wrapper for the OpenIGTLink message type.
Definition: mitkIGTLMessage.h:35
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::IGTLMessage::m_Name
std::string m_Name
name of the navigation data
Definition: mitkIGTLMessage.h:157
mitkNumericTypes.h
mitkCommon.h
mitk::IGTLMessage::TimeStampType
double TimeStampType
type that holds the time at which the data was recorded in milliseconds
Definition: mitkIGTLMessage.h:46
mitkCloneMacro
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:154
mitk::Message
Event/message/notification class.
Definition: mitkMessage.h:452
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20