Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef MITKIGTLMESSAGEH_HEADER_INCLUDED_
19 #define MITKIGTLMESSAGEH_HEADER_INCLUDED_
20 
21 #include <itkDataObject.h>
22 #include "MitkOpenIGTLinkExports.h"
23 #include <mitkNumericTypes.h>
24 #include <mitkCommon.h>
25 
26 #include "igtlMessageBase.h"
27 
28 namespace mitk {
29 
39  class MITKOPENIGTLINK_EXPORT IGTLMessage : public itk::DataObject
40  {
41  public:
42  mitkClassMacroItkParent(IGTLMessage, itk::DataObject);
43  itkFactorylessNewMacro(Self);
44  itkCloneMacro(Self);
46 
50  typedef double TimeStampType;
51 
55  void SetMessage(igtl::MessageBase::Pointer msg);
59  itkGetConstMacro(Message, igtl::MessageBase::Pointer);
63  virtual bool IsDataValid() const;
68  itkSetMacro(DataValid, bool);
72  itkGetConstMacro(IGTTimeStamp, TimeStampType);
76  itkSetStringMacro(Name);
80  itkGetStringMacro(Name);
81 
92  virtual void Graft(const DataObject *data) override;
93 
99  virtual void CopyInformation(const DataObject* data) override;
100 
106  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
107 
118  void Compose(const mitk::IGTLMessage::Pointer n, const bool pre = false);
119 
122  const char* GetIGTLMessageType() const;
123 
124  template < typename IGTLMessageType > IGTLMessageType* GetMessage() const;
125 
126  protected:
127  mitkCloneMacro(Self);
128 
129  IGTLMessage();
130 
134  IGTLMessage(const mitk::IGTLMessage& toCopy);
135 
139  IGTLMessage(igtl::MessageBase::Pointer message, std::string name = "");
140 
141  virtual ~IGTLMessage();
142 
147 
155  TimeStampType m_IGTTimeStamp;
159  std::string m_Name;
160 
161  private:
162 
163  // pre = false
164  static mitk::IGTLMessage::Pointer getComposition(
165  const mitk::IGTLMessage::Pointer nd1,
166  const mitk::IGTLMessage::Pointer nd2);
167 
171  itkSetMacro(IGTTimeStamp, TimeStampType);
172 
173  };
174 
191  MITKOPENIGTLINK_EXPORT bool Equal( const mitk::IGTLMessage& leftHandSide,
192  const mitk::IGTLMessage& rightHandSide,
194  bool verbose = false );
195 
196 } // namespace mitk
197 #endif /* MITKIGTLMESSAGEH_HEADER_INCLUDED_ */
std::string m_Name
name of the navigation data
itk::SmartPointer< Self > Pointer
double ScalarType
DataCollection - Class to facilitate loading/accessing structured data.
bool m_DataValid
defines if the object contains valid values
Time stamp in milliseconds.
#define mitkNewMacro2Param(classname, typea, typeb)
Definition: mitkCommon.h:89
A wrapper for the OpenIGTLink message type.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
Event/message/notification class.
Definition: mitkMessage.h:572
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:162
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