PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusOpenIGTLinkDevice.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2  Program: Plus
3  Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4  See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef __vtkPlusOpenIGTLinkDevice_h
8 #define __vtkPlusOpenIGTLinkDevice_h
9 
10 #include "vtkPlusDataCollectionExport.h"
11 #include "PlusConfigure.h"
12 #include "vtkPlusDevice.h"
13 
14 // IGTL includes
15 #include <igtlClientSocket.h>
16 #include <igtlMessageBase.h>
17 
19 
26 class vtkPlusDataCollectionExport vtkPlusOpenIGTLinkDevice : public vtkPlusDevice
27 {
28 public:
30  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
31 
33  virtual std::string GetSdkVersion();
34 
36  virtual PlusStatus InternalConnect();
37 
40 
42  virtual PlusStatus Probe();
43 
45  virtual PlusStatus ReadConfiguration(vtkXMLDataElement* config);
46 
48  virtual PlusStatus WriteConfiguration(vtkXMLDataElement* config);
49 
51  bool SendMessage(igtl::MessageBase::Pointer packedMessage);
52 
54  vtkSetStdStringMacro(MessageType);
56  vtkGetStdStringMacro(MessageType);
57 
59  vtkSetMacro(ImageMessageEmbeddedTransformName, igsioTransformName);
60  vtkSetMacro(ImageMessageEmbeddedTransformName, std::string);
61 
63  vtkGetMacro(ImageMessageEmbeddedTransformName, igsioTransformName);
64 
66  vtkSetStdStringMacro(ServerAddress);
68  vtkGetStdStringMacro(ServerAddress);
69 
71  vtkSetMacro(ServerPort, int);
73  vtkGetMacro(ServerPort, int);
74 
76  vtkSetMacro(ReceiveTimeoutSec, double);
78  vtkGetMacro(ReceiveTimeoutSec, double);
79 
81  vtkSetMacro(SendTimeoutSec, double);
83  vtkGetMacro(SendTimeoutSec, double);
84 
86  vtkSetMacro(IgtlMessageCrcCheckEnabled, int);
88  vtkGetMacro(IgtlMessageCrcCheckEnabled, int);
89 
91  vtkGetMacro(ReconnectOnReceiveTimeout, bool);
92 
93 protected:
95  virtual ~vtkPlusOpenIGTLinkDevice();
96 
98  virtual PlusStatus ClientSocketReconnect();
99 
101  virtual PlusStatus SendRequestedMessageTypes();
102 
107  void OnReceiveTimeout();
108 
112  void ReceiveMessageHeaderWithErrorHandling(igtl::MessageHeader::Pointer& headerMsg);
113 
119  virtual PlusStatus ReceiveMessageHeader(igtl::MessageHeader::Pointer& headerMsg);
120 
122  vtkSetMacro(ReconnectOnReceiveTimeout, bool);
123 
124  vtkSetMacro(UseReceivedTimestamps, bool);
125 
127  std::string MessageType;
128 
131 
133  std::string ServerAddress;
134 
137 
141 
144 
147 
150 
151  /* IGTL message factory*/
152  vtkSmartPointer<vtkPlusIgtlMessageFactory> MessageFactory;
153 
155  vtkSmartPointer<vtkIGSIORecursiveCriticalSection> SocketMutex;
156 
158  igtl::ClientSocket::Pointer ClientSocket;
159 
162 
168 
169 private:
170  vtkPlusOpenIGTLinkDevice(const vtkPlusOpenIGTLinkDevice&); // Not implemented.
171  void operator=(const vtkPlusOpenIGTLinkDevice&); // Not implemented.
172 };
173 
174 #endif
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
Abstract interface for tracker and video devices.
Definition: vtkPlusDevice.h:60
virtual PlusStatus InternalConnect()
igsioStatus PlusStatus
Definition: PlusCommon.h:40
vtkSmartPointer< vtkPlusIgtlMessageFactory > MessageFactory
vtkSmartPointer< vtkIGSIORecursiveCriticalSection > SocketMutex
igsioTransformName ImageMessageEmbeddedTransformName
virtual std::string GetSdkVersion()
virtual PlusStatus Probe()
#define VTK_OVERRIDE
Definition: PlusCommon.h:49
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *)
Common base class for OpenIGTLink-based tracking and video devices.
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *)
Factory class of supported OpenIGTLink message types.
igtl::ClientSocket::Pointer ClientSocket
virtual PlusStatus InternalDisconnect()