Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
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 MITKIGTLMESSAGEH_HEADER_INCLUDED_
15 #define MITKIGTLMESSAGEH_HEADER_INCLUDED_
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 
153  TimeStampType m_IGTTimeStamp;
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 /* MITKIGTLMESSAGEH_HEADER_INCLUDED_ */
std::string m_Name
name of the navigation data
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:72
double ScalarType
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKOPENIGTLINK_EXPORT
bool m_DataValid
defines if the object contains valid values
Time stamp in milliseconds.
A wrapper for the OpenIGTLink message type.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
bool verbose(false)
Event/message/notification class.
Definition: mitkMessage.h:568
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:158
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.
MITKCORE_EXPORT const ScalarType eps
TimeStampType m_IGTTimeStamp
contains the time at which the tracking data was recorded
igtl::MessageBase::Pointer m_Message
holds the actual OpenIGTLink message
double TimeStampType
type that holds the time at which the data was recorded in milliseconds