Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkIGTLMessageProvider.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 mitkIGTLMessageProvider_h
14 #define mitkIGTLMessageProvider_h
15 
16 #include "mitkIGTLDevice.h"
17 #include "mitkIGTLDeviceSource.h"
18 
19 //itk
20 #include "itkCommand.h"
21 
22 namespace mitk {
47  class MITKOPENIGTLINK_EXPORT IGTLMessageProvider : public IGTLDeviceSource
48  {
49  public:
51  itkFactorylessNewMacro(Self);
52  itkCloneMacro(Self);
53 
54  typedef itk::SimpleMemberCommand<mitk::IGTLMessageProvider> ProviderCommand;
55 
61  void Send(mitk::IGTLMessage::Pointer msg);
62 
66  void StartStreamingOfSource(mitk::IGTLMessageSource* src,
67  unsigned int fps);
68 
72  void StopStreamingOfSource(mitk::IGTLMessageSource* src);
73 
77  void StopStreamingOfAllSources();
78 
82  bool IsStreaming();
83 
87  itkGetMacro(StreamingTime, unsigned int);
88 
89  void Update() override;
90 
91  protected:
93  ~IGTLMessageProvider() override;
94 
103  void GenerateData() override;
104 
111  void CreateOutputs();
112 
117  void OnIncomingMessage() override;
118 
123  void OnIncomingCommand() override;
124 
128  void OnLostConnection() override;
129 
137  void ConnectTo( mitk::IGTLMessageSource* UpstreamFilter );
138 
146  void DisconnectFrom( mitk::IGTLMessageSource* UpstreamFilter );
147 
152  mitk::IGTLMessageSource::Pointer GetFittingSource(const char* requestedType);
153 
157  void InvokeStartStreamingEvent();
158 
162  void InvokeStopStreamingEvent();
163 
164  private:
168  ProviderCommand::Pointer m_StreamingCommand;
169 
170  ProviderCommand::Pointer m_StopStreamingCommand;
171 
173  // * \brief Timer thread for generating a continuous time signal for the stream
174  // *
175  // * Everyt time the time is passed a time signal is invoked.
176  // *
177  // * \param pInfoStruct pointer to the mitkIGTLMessageProvider object
178  // * \return
179  // */
180  //static ITK_THREAD_RETURN_TYPE TimerThread(void* pInfoStruct);
181 
182  //int m_ThreadId;
183 
185  //bool m_StopStreamingThread;
186 
187  //itk::SmartPointer<itk::MultiThreader> m_MultiThreader;
188 
190  unsigned int m_StreamingTime;
191 
193  std::mutex m_StreamingTimeMutex;
194 
196  //itk::SmartPointer<itk::FastMutexLock> m_StopStreamingThreadMutex;
197 
199  bool m_IsStreaming;
200 
201  };
202 
211  itkEventMacroDeclaration(StreamingStartRequiredEvent, itk::AnyEvent);
212 
218  itkEventMacroDeclaration(StreamingStopRequiredEvent, itk::AnyEvent);
219 
220 } // namespace mitk
221 #endif
mitk::IGTLMessageProvider::ProviderCommand
itk::SimpleMemberCommand< mitk::IGTLMessageProvider > ProviderCommand
Definition: mitkIGTLMessageProvider.h:52
mitk::IGTLMessageSource
OpenIGTLink message source.
Definition: mitkIGTLMessageSource.h:41
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::IGTLDeviceSource
Connects a mitk::IGTLDevice to a MITK-OpenIGTLink-Message-Filter-Pipeline.
Definition: mitkIGTLDeviceSource.h:30
mitk::IGTLMessageProvider
Provides information/objects from a MITK-Pipeline to other OpenIGTLink devices.
Definition: mitkIGTLMessageProvider.h:47
mitkIGTLDeviceSource.h
mitk::itkEventMacroDeclaration
itkEventMacroDeclaration(BoundingShapeInteractionEvent, itk::AnyEvent)
mitkIGTLDevice.h