CustusX  2021.04.21-dev+develop.337f9
An IGT application
cxNetworkHandler.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CX_NETWORKHANDLER_H_
13 #define CX_NETWORKHANDLER_H_
14 
15 #include "org_custusx_core_openigtlink3_Export.h"
16 #include "igtlioLogic.h"
17 #include "igtlioSession.h"
18 
19 #include "cxTransform3D.h"
20 #include "cxImage.h"
21 #include "cxMesh.h"
23 
24 #include "ctkVTKObject.h"
25 
26 namespace cx
27 {
28 
29 typedef boost::shared_ptr<class NetworkHandler> NetworkHandlerPtr;
30 
31 class org_custusx_core_openigtlink3_EXPORT NetworkHandler : public QObject
32 {
33  Q_OBJECT
34  QVTK_OBJECT
35 
36 public:
37  NetworkHandler(igtlioLogicPointer logic);
38  ~NetworkHandler();
39 
40  igtlioSessionPointer requestConnectToServer(std::string serverHost, int serverPort=-1, IGTLIO_SYNCHRONIZATION_TYPE sync=IGTLIO_BLOCKING, double timeout_s=5);
41  void disconnectFromServer();
42 
43 signals:
44  void connected();
45  void disconnected();
46 
47  void transform(QString devicename, Transform3D transform, double timestamp);
48  void image(ImagePtr image);
49  void commandRespons(QString devicename, QString xml);
50  void string_message(QString message);
51  //void mesh(MeshPtr image);
52  void probedefinition(QString devicename, ProbeDefinitionPtr definition);
53  //void calibration(QString devicename, Transform3D calibration);
54 
55 private slots:
56  void onConnectionEvent(vtkObject* caller, void* connector, unsigned long event, void*);
57  void onDeviceAddedOrRemoved(vtkObject* caller, void* connector, unsigned long event, void*callData);
58  void onDeviceReceived(vtkObject * caller_device, void * unknown, unsigned long event, void *);
59  void periodicProcess();
60 
61 private:
62  void connectToConnectionEvents();
63  void connectToDeviceEvents();
64 
65  igtlioLogicPointer mLogic;
66  igtlioSessionPointer mSession;
67  QTimer *mTimer;
68  ProbeDefinitionFromStringMessagesPtr mProbeDefinitionFromStringMessages;
69 };
70 
71 } // namespace cx
72 
73 #endif /* CX_NETWORKHANDLER_H_ */
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
boost::shared_ptr< class NetworkHandler > NetworkHandlerPtr
boost::shared_ptr< class ProbeDefinitionFromStringMessages > ProbeDefinitionFromStringMessagesPtr
boost::shared_ptr< class ProbeDefinition > ProbeDefinitionPtr
Namespace for all CustusX production code.