MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkIGTLMessageProvider.h
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13#ifndef mitkIGTLMessageProvider_h
14#define mitkIGTLMessageProvider_h
15
16#include "mitkIGTLDevice.h"
18
19//itk
20#include "itkCommand.h"
21
22namespace mitk {
47 class MITKOPENIGTLINK_EXPORT IGTLMessageProvider : public IGTLDeviceSource
48 {
49 public:
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
Connects a mitk::IGTLDevice to a MITK-OpenIGTLink-Message-Filter-Pipeline.
Provides information/objects from a MITK-Pipeline to other OpenIGTLink devices.
itk::SimpleMemberCommand< mitk::IGTLMessageProvider > ProviderCommand
itkGetMacro(StreamingTime, unsigned int)
Get method for the streaming time.
mitkClassMacro(IGTLMessageProvider, IGTLDeviceSource)
OpenIGTLink message source.
IGT Exceptions.
itkEventMacroDeclaration(MessageSentEvent, itk::AnyEvent)
connect to this Event to get notified when a message was successfully sent