NorMIT-nav
22.09
An IGT application
cxGrabberSenderQTcpSocket.cpp
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
#include "
cxGrabberSenderQTcpSocket.h
"
13
#include "
cxIGTLinkConversion.h
"
14
#include "
cxIGTLinkConversionImage.h
"
15
#include "
cxIGTLinkConversionSonixCXLegacy.h
"
16
17
namespace
cx
18
{
19
20
GrabberSenderQTcpSocket::GrabberSenderQTcpSocket
(QTcpSocket* socket)
21
{
22
mMaxBufferSize = 19200000;
//800(width)*600(height)*4(bytes)*10(images)
23
mSocket = socket;
24
}
25
26
bool
GrabberSenderQTcpSocket::isReady
()
const
27
{
28
if
(!mSocket)
29
return
false
;
30
if
(mSocket->bytesToWrite() > mMaxBufferSize)
31
return
false
;;
32
return
true
;
33
}
34
35
void
GrabberSenderQTcpSocket::send
(igtl::ImageMessage::Pointer msg)
36
{
37
if
(!msg || !this->
isReady
())
38
return
;
39
40
// Pack (serialize) and send
41
msg->Pack();
42
mSocket->write(
reinterpret_cast<
const
char
*
>
(msg->GetPackPointer()), msg->GetPackSize());
43
}
44
45
void
GrabberSenderQTcpSocket::send
(
IGTLinkUSStatusMessage::Pointer
msg)
46
{
47
if
(!msg || !this->
isReady
())
48
return
;
49
50
// Pack (serialize) and send
51
msg->Pack();
52
mSocket->write(
reinterpret_cast<
const
char
*
>
(msg->GetPackPointer()), msg->GetPackSize());
53
}
54
55
void
GrabberSenderQTcpSocket::send
(
ImagePtr
msg)
56
{
57
if
(!this->
isReady
())
58
return
;
59
60
IGTLinkConversionImage
converter;
61
this->
send
(converter.
encode
(msg,
pcsLPS
));
62
}
63
64
void
GrabberSenderQTcpSocket::send
(
ProbeDefinitionPtr
msg)
65
{
66
if
(!this->
isReady
())
67
return
;
68
69
IGTLinkConversion
converter;
70
this->
send
(converter.
encode
(msg));
71
}
72
73
74
}
/* namespace cx */
cx::IGTLinkConversionImage
Definition:
cxIGTLinkConversionImage.h:47
cx
Namespace for all CustusX production code.
Definition:
cx_dev_group_definitions.h:13
cx::GrabberSenderQTcpSocket::send
virtual void send(igtl::ImageMessage::Pointer msg)
Definition:
cxGrabberSenderQTcpSocket.cpp:35
pcsLPS
pcsLPS
Left-Posterior-Superior, used internally by CustusX, also DICOM, ITK.
Definition:
cxDefinitions.h:104
cx::ProbeDefinitionPtr
boost::shared_ptr< class ProbeDefinition > ProbeDefinitionPtr
Definition:
cxImageReceiverThread.h:32
cxIGTLinkConversion.h
cx::GrabberSenderQTcpSocket::isReady
bool isReady() const
Definition:
cxGrabberSenderQTcpSocket.cpp:26
cx::IGTLinkConversionImage::encode
igtl::ImageMessage::Pointer encode(ImagePtr in, PATIENT_COORDINATE_SYSTEM externalSpace)
Definition:
cxIGTLinkConversionImage.cpp:37
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition:
cxDicomWidget.h:27
cxIGTLinkConversionSonixCXLegacy.h
cx::IGTLinkUSStatusMessage::Pointer
igtl::SmartPointer< Self > Pointer
Definition:
cxIGTLinkUSStatusMessage.h:48
cxIGTLinkConversionImage.h
cxGrabberSenderQTcpSocket.h
cx::IGTLinkConversion::encode
igtl::StringMessage::Pointer encode(QString msg)
Definition:
cxIGTLinkConversion.cpp:29
cx::IGTLinkConversion
Definition:
cxIGTLinkConversion.h:42
cx::GrabberSenderQTcpSocket::GrabberSenderQTcpSocket
GrabberSenderQTcpSocket(QTcpSocket *socket)
Definition:
cxGrabberSenderQTcpSocket.cpp:20
CX
source
resource
videoServer
cxGrabberSenderQTcpSocket.cpp
Generated on Tue Sep 13 2022 11:06:16 for NorMIT-nav by
1.8.17