26 mConnection(networkHandler),
27 mTrackingService(trackingService),
28 mStartedTrackingAndOpenIGTLinkFromHere(false)
42 this->stopTrackingAndOpenIGTLinkClientIfStartedFromThisObject();
47 return "OpenIGTLink 3 streamer";
57 std::vector<PropertyPtr> retval;
58 retval.push_back(this->getIPOption(root));
59 retval.push_back(this->getStreamPortOption(root));
60 retval.push_back(this->trackAndStream(root));
67 this->startTracking(root);
73 this->stopTrackingAndOpenIGTLinkClientIfStartedFromThisObject();
76 void OpenIGTLinkStreamerService::stopTrackingAndOpenIGTLinkClientIfStartedFromThisObject()
78 if(mStartedTrackingAndOpenIGTLinkFromHere)
80 mConnection->disconnectFromServer();
83 if(trackingSystemService)
86 mStartedTrackingAndOpenIGTLinkFromHere =
false;
90 void OpenIGTLinkStreamerService::startTracking(QDomElement root)
92 if(this->trackAndStream(root)->getValue())
94 mStartedTrackingAndOpenIGTLinkFromHere =
true;
95 this->configureTracking(root);
101 mConnection->requestConnectToServer(this->getIPOption(root)->getValue().toStdString(),
102 int(this->getStreamPortOption(root)->getValue()));
106 void OpenIGTLinkStreamerService::configureTracking(QDomElement root)
110 if(trackingSystemService)
112 QFileInfo fileInfo(
profile()->getToolConfigFilePath());
113 trackingSystemService->setConfigurationFile(fileInfo.filePath());
120 std::vector<TrackingSystemServicePtr> trackingSystems = mTrackingService->getTrackingSystems();
121 for (
unsigned i = 0; i < trackingSystems.size(); ++i)
124 if(trackingSystemService)
125 return trackingSystemService;
135 "Combined functionality: \n" 136 "Run both tracking and streaming over OpenIGTLink",
138 retval->setGroup(
"Connection");
146 QString defaultValue =
"127.0.0.1";
149 retval->setGroup(
"Connection");
159 retval->setAdvanced(
true);
160 retval->setGroup(
"Connection");
cxResource_EXPORT ProfilePtr profile()
static BoolPropertyPtr initialize(const QString &uid, QString name, QString help, bool value, QDomNode root=QDomNode())
virtual QString getName()
boost::shared_ptr< class TrackingService > TrackingServicePtr
void receiveProbedefinition(QString not_used, ProbeDefinitionPtr probedef)
Utility class for describing a bounded numeric range.
#define OPENIGTLINK3_STREAMER
void receivedImage(ImagePtr image)
boost::shared_ptr< class NetworkHandler > NetworkHandlerPtr
boost::shared_ptr< OpenIGTLinkStreamer > OpenIGTLinkStreamerPtr
boost::shared_ptr< class StringProperty > StringPropertyPtr
void receivedDisconnected()
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr
boost::shared_ptr< class BoolPropertyBase > BoolPropertyBasePtr
virtual ~OpenIGTLinkStreamerService()
void probedefinition(QString devicename, ProbeDefinitionPtr definition)
virtual StreamerPtr createStreamer(QDomElement root)
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
OpenIGTLinkStreamerService(NetworkHandlerPtr networkHandler, TrackingServicePtr trackingService)
virtual QString getType() const
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
virtual std::vector< PropertyPtr > getSettings(QDomElement root)
boost::shared_ptr< class OpenIGTLinkTrackingSystemService > OpenIGTLinkTrackingSystemServicePtr
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
#define OPENIGTLINK3_STREAMER_IP
#define OPENIGTLINK3_STREAMER_START_TRACKING
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< class Streamer > StreamerPtr
void image(ImagePtr image)
Namespace for all CustusX production code.