Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 IGTLMESSAGEPROVIDER_H_HEADER_INCLUDED_
14 #define IGTLMESSAGEPROVIDER_H_HEADER_INCLUDED_
15 
16 #include "mitkIGTLDevice.h"
17 #include "mitkIGTLDeviceSource.h"
18 
19 //itk
20 #include "itkCommand.h"
21 
22 namespace mitk {
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  itk::SmartPointer<itk::FastMutexLock> m_StreamingTimeMutex;
194 
196  //itk::SmartPointer<itk::FastMutexLock> m_StopStreamingThreadMutex;
197 
199  bool m_IsStreaming;
200 
201  };
202 
211  itkEventMacro(StreamingStartRequiredEvent, itk::AnyEvent);
212 
218  itkEventMacro(StreamingStopRequiredEvent, itk::AnyEvent);
219 
220 } // namespace mitk
221 #endif /* MITKIGTLMESSAGEPROVIDER_H_HEADER_INCLUDED_ */
Connects a mitk::IGTLDevice to a MITK-OpenIGTLink-Message-Filter-Pipeline.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:31
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKOPENIGTLINK_EXPORT
itk::SimpleMemberCommand< mitk::IGTLMessageProvider > ProviderCommand
A wrapper for the OpenIGTLink message type.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
OpenIGTLink message source.
Provides information/objects from a MITK-Pipeline to other OpenIGTLink devices.
itkEventMacro(ContourModelEvent, itk::AnyEvent)