Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkIGTLDeviceSetupConnectionWidget.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 #ifndef QmitkIGTLDeviceSetupConnectionWidget_H
18 #define QmitkIGTLDeviceSetupConnectionWidget_H
19 
20 //QT headers
21 #include <QWidget>
22 #include <QTimer>
23 
24 //mitk headers
25 #include "MitkOpenIGTLinkUIExports.h"
26 #include "mitkIGTLDeviceSource.h"
27 #include "mitkIGTLClient.h"
28 #include "mitkDataStorage.h"
29 
30 //itk
31 #include <itkCommand.h>
32 
33 //ui header
34 #include "ui_QmitkIGTLDeviceSetupConnectionWidgetControls.h"
35 
43 class MITKOPENIGTLINKUI_EXPORT QmitkIGTLDeviceSetupConnectionWidget : public QWidget
44 {
45  Q_OBJECT
46 
47  public:
48  static const std::string VIEW_ID;
49 
60  void Initialize(mitk::IGTLDevice::Pointer device);
61 
62  QmitkIGTLDeviceSetupConnectionWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
64 
65 // /**
66 // * \brief Is called when the current device received a message
67 // */
68 // void OnMessageReceived(itk::Object* caller, const itk::EventObject&);
69 
70 // /**
71 // * \brief Is called when the current device received a command
72 // */
73 // void OnCommandReceived(itk::Object* caller, const itk::EventObject&);
74 
79  void OnLostConnection();
80 
84  void OnNewConnection();
85 
89  void OnMessageReceived();
90 
94  void OnMessageSent();
95 
99  void OnCommandReceived();
100 
101  protected slots:
102 
103  void OnConnect();
104  void OnPortChanged();
105  void OnHostnameChanged();
106  void OnUpdateFPSLabel();
107 
111  void OnBufferIncomingMessages(int state);
112 
118  void OnBufferOutgoingMessages(int state);
119 
123  void AdaptGUIToState();
124 
125  signals:
130  void AdaptGUIToStateSignal();
131 
132  protected:
136  void OnDeviceStateChanged();
137 
139  virtual void CreateConnections();
140 
141  virtual void CreateQtPartControl(QWidget *parent);
142 
143  Ui::QmitkIGTLDeviceSetupConnectionWidgetControls* m_Controls;
144 
147 
150 
157 
164 
171 
174 
175  //############## private help methods #######################
176  void DisableSourceControls();
177 // void EnableSourceControls();
178  void RemoveObserver();
179 };
180 #endif
itk::SmartPointer< Self > Pointer
QTimer m_FPSCalculationTimer
the timer used to calculate the frames per second
Ui::QmitkIGTLDeviceSetupConnectionWidgetControls * m_Controls
unsigned int m_NumSentFramesSinceLastUpdate
the number of sent frames (messages) since the last fps calculation update
mitk::IGTLDevice::Pointer m_IGTLDevice
holds the OpenIGTLink device
bool m_IsClient
flag to indicate if the IGTL device is a client or a server
An object of this class offers an UI to setup the connection of an OpenIGTLink device.
unsigned int m_NumReceivedFramesSinceLastUpdate
the number of received frames (messages) since the last fps calculation update