Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkIGTLMessageQueue.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 #ifndef mitkIGTLMessageQueue_h
14 #define mitkIGTLMessageQueue_h
15 
16 #include "MitkOpenIGTLinkExports.h"
17 
18 #include "itkObject.h"
19 #include "mitkCommon.h"
20 
21 #include <deque>
22 #include <mutex>
23 #include <mitkIGTLMessage.h>
24 
25 //OpenIGTLink
26 #include "igtlMessageBase.h"
27 #include "igtlImageMessage.h"
28 #include "igtlStringMessage.h"
29 #include "igtlTrackingDataMessage.h"
30 #include "igtlTransformMessage.h"
31 
32 namespace mitk {
39  class MITKOPENIGTLINK_EXPORT IGTLMessageQueue : public itk::Object
40  {
41  public:
43  itkFactorylessNewMacro(Self);
44  itkCloneMacro(Self);
45 
51  enum BufferingType { Infinit, NoBuffering };
52 
53  void PushSendMessage(mitk::IGTLMessage::Pointer message);
54 
58  void PushMessage(igtl::MessageBase::Pointer message);
59 
63  void PushCommandMessage(igtl::MessageBase::Pointer message);
67  igtl::MessageBase::Pointer PullMiscMessage();
68  igtl::ImageMessage::Pointer PullImage2dMessage();
69  igtl::ImageMessage::Pointer PullImage3dMessage();
70  igtl::TrackingDataMessage::Pointer PullTrackingMessage();
71  igtl::MessageBase::Pointer PullCommandMessage();
72  igtl::StringMessage::Pointer PullStringMessage();
73  igtl::TransformMessage::Pointer PullTransformMessage();
74  mitk::IGTLMessage::Pointer PullSendMessage();
75 
79  int GetSize();
80 
85  std::string GetNextMsgInformationString();
86 
90  std::string GetNextMsgDeviceType();
91 
96  std::string GetLatestMsgInformationString();
97 
101  std::string GetLatestMsgDeviceType();
102 
105  void EnableNoBufferingMode(bool enable);
106 
107  protected:
109  ~IGTLMessageQueue() override;
110 
111  protected:
115  std::mutex m_Mutex;
116 
120  std::deque< igtl::MessageBase::Pointer > m_CommandQueue;
121  std::deque< igtl::ImageMessage::Pointer > m_Image2dQueue;
122  std::deque< igtl::ImageMessage::Pointer > m_Image3dQueue;
123  std::deque< igtl::TransformMessage::Pointer > m_TransformQueue;
124  std::deque< igtl::TrackingDataMessage::Pointer > m_TrackingDataQueue;
125  std::deque< igtl::StringMessage::Pointer > m_StringQueue;
126  std::deque< igtl::MessageBase::Pointer > m_MiscQueue;
127 
128  std::deque< mitk::IGTLMessage::Pointer > m_SendQueue;
129 
130  igtl::MessageBase::Pointer m_Latest_Message;
131 
136  };
137 }
138 
139 #endif
mitk::IGTLMessageQueue::m_StringQueue
std::deque< igtl::StringMessage::Pointer > m_StringQueue
Definition: mitkIGTLMessageQueue.h:125
mitk::IGTLMessageQueue::m_SendQueue
std::deque< mitk::IGTLMessage::Pointer > m_SendQueue
Definition: mitkIGTLMessageQueue.h:128
mitk::IGTLMessageQueue::m_Image3dQueue
std::deque< igtl::ImageMessage::Pointer > m_Image3dQueue
Definition: mitkIGTLMessageQueue.h:122
mitk::IGTLMessageQueue::BufferingType
BufferingType
Different buffering types Infinit buffering means that you can push as many messages as you want NoBu...
Definition: mitkIGTLMessageQueue.h:51
mitk::IGTLMessageQueue::m_BufferingType
BufferingType m_BufferingType
defines the kind of buffering
Definition: mitkIGTLMessageQueue.h:135
mitk::IGTLMessageQueue
Thread safe message queue to store OpenIGTLink messages.
Definition: mitkIGTLMessageQueue.h:39
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::IGTLMessageQueue::m_TrackingDataQueue
std::deque< igtl::TrackingDataMessage::Pointer > m_TrackingDataQueue
Definition: mitkIGTLMessageQueue.h:124
mitk::IGTLMessageQueue::m_TransformQueue
std::deque< igtl::TransformMessage::Pointer > m_TransformQueue
Definition: mitkIGTLMessageQueue.h:123
mitkCommon.h
mitk::IGTLMessageQueue::m_CommandQueue
std::deque< igtl::MessageBase::Pointer > m_CommandQueue
the queue that stores pointer to the inserted messages
Definition: mitkIGTLMessageQueue.h:120
mitk::IGTLMessageQueue::m_Mutex
std::mutex m_Mutex
Mutex to take car of the queue.
Definition: mitkIGTLMessageQueue.h:115
mitkIGTLMessage.h
mitk::IGTLMessageQueue::m_Latest_Message
igtl::MessageBase::Pointer m_Latest_Message
Definition: mitkIGTLMessageQueue.h:130
mitk::IGTLMessageQueue::m_MiscQueue
std::deque< igtl::MessageBase::Pointer > m_MiscQueue
Definition: mitkIGTLMessageQueue.h:126
mitk::IGTLMessageQueue::m_Image2dQueue
std::deque< igtl::ImageMessage::Pointer > m_Image2dQueue
Definition: mitkIGTLMessageQueue.h:121