Medical Imaging Interaction Toolkit  2023.12.00
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 (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 QmitkIGTLDeviceSetupConnectionWidget_h
14 #define QmitkIGTLDeviceSetupConnectionWidget_h
15 
16 //QT headers
17 #include <QWidget>
18 #include <QTimer>
19 
20 //mitk headers
21 #include "MitkOpenIGTLinkUIExports.h"
22 #include "mitkIGTLDeviceSource.h"
23 #include "mitkIGTLClient.h"
24 #include "mitkDataStorage.h"
25 
26 //itk
27 #include <itkCommand.h>
28 
29 //ui header
30 #include "ui_QmitkIGTLDeviceSetupConnectionWidgetControls.h"
31 
39 class MITKOPENIGTLINKUI_EXPORT QmitkIGTLDeviceSetupConnectionWidget : public QWidget
40 {
41  Q_OBJECT
42 
43  public:
44  static const std::string VIEW_ID;
45 
56  void Initialize(mitk::IGTLDevice::Pointer device);
57 
58  QmitkIGTLDeviceSetupConnectionWidget(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
60 
61 // /**
62 // * \brief Is called when the current device received a message
63 // */
64 // void OnMessageReceived(itk::Object* caller, const itk::EventObject&);
65 
66 // /**
67 // * \brief Is called when the current device received a command
68 // */
69 // void OnCommandReceived(itk::Object* caller, const itk::EventObject&);
70 
75  void OnLostConnection();
76 
80  void OnNewConnection();
81 
85  void OnMessageReceived();
86 
90  void OnMessageSent();
91 
95  void OnCommandReceived();
96 
97  protected slots:
98 
99  void OnConnect();
100  void OnPortChanged();
101  void OnHostnameChanged();
102  void OnUpdateFPSLabel();
103 
107  void OnLogMessageDetailsCheckBoxClicked();
108 
112  void OnBufferIncomingMessages(int state);
113 
119  void OnBufferOutgoingMessages(int state);
120 
124  void AdaptGUIToState();
125 
126  signals:
131  void AdaptGUIToStateSignal();
132 
133  protected:
137  void OnDeviceStateChanged();
138 
140  virtual void CreateConnections();
141 
142  virtual void CreateQtPartControl(QWidget *parent);
143 
144  Ui::QmitkIGTLDeviceSetupConnectionWidgetControls* m_Controls;
145 
147  mitk::IGTLDevice::Pointer m_IGTLDevice;
148 
151 
158 
165 
172 
175 
176  //############## private help methods #######################
177  void DisableSourceControls();
178 // void EnableSourceControls();
179  void RemoveObserver();
180 };
181 #endif
QmitkIGTLDeviceSetupConnectionWidget::m_IGTLDevice
mitk::IGTLDevice::Pointer m_IGTLDevice
holds the OpenIGTLink device
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:147
QmitkIGTLDeviceSetupConnectionWidget::m_CommandReceivedObserverTag
unsigned long m_CommandReceivedObserverTag
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:154
QmitkIGTLDeviceSetupConnectionWidget::m_NumSentFramesSinceLastUpdate
unsigned int m_NumSentFramesSinceLastUpdate
the number of sent frames (messages) since the last fps calculation update
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:171
QmitkIGTLDeviceSetupConnectionWidget::VIEW_ID
static const std::string VIEW_ID
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:44
QmitkIGTLDeviceSetupConnectionWidget::m_NewConnectionObserverTag
unsigned long m_NewConnectionObserverTag
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:156
QmitkIGTLDeviceSetupConnectionWidget::m_MessageSentObserverTag
unsigned long m_MessageSentObserverTag
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:152
mitkDataStorage.h
QmitkIGTLDeviceSetupConnectionWidget::m_IsClient
bool m_IsClient
flag to indicate if the IGTL device is a client or a server
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:150
mitkIGTLClient.h
QmitkIGTLDeviceSetupConnectionWidget::m_Controls
Ui::QmitkIGTLDeviceSetupConnectionWidgetControls * m_Controls
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:144
QmitkIGTLDeviceSetupConnectionWidget::m_FPSCalculationTimer
QTimer m_FPSCalculationTimer
the timer used to calculate the frames per second
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:174
QmitkIGTLDeviceSetupConnectionWidget::m_MessageReceivedObserverTag
unsigned long m_MessageReceivedObserverTag
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:153
QmitkIGTLDeviceSetupConnectionWidget::m_NumReceivedFramesSinceLastUpdate
unsigned int m_NumReceivedFramesSinceLastUpdate
the number of received frames (messages) since the last fps calculation update
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:164
QmitkIGTLDeviceSetupConnectionWidget::m_LostConnectionObserverTag
unsigned long m_LostConnectionObserverTag
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:155
QmitkIGTLDeviceSetupConnectionWidget
An object of this class offers an UI to setup the connection of an OpenIGTLink device.
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:39
mitkIGTLDeviceSource.h
QmitkIGTLDeviceSetupConnectionWidget::m_StateModifiedObserverTag
unsigned long m_StateModifiedObserverTag
Definition: QmitkIGTLDeviceSetupConnectionWidget.h:157