OpenWalnut  1.5.0dev
WMOpenIGTLink.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WMOPENIGTLINK_H
26 #define WMOPENIGTLINK_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Geode>
32 
33 #include "core/kernel/WModule.h"
34 #include "core/kernel/WModuleInputData.h"
35 #include "core/kernel/WModuleOutputData.h"
36 
37 /**
38  * This module provides an interface to OpenIGTLink, a protocol to exchange
39  * data remotely over IP networks.
40  *
41  * The module can act as a source or sink and, thus, transmit or receive data
42  * to and from servers or clients across the network.
43  * Clients that support the protocol are most VTK-based applications, including
44  * 3D Slicer, but there are interfaces for other tools such as MATLAB or proprietary
45  * scanner software as well.
46  *
47  * For more information see http://www.na-mic.org/Wiki/index.php/OpenIGTLink
48  *
49  * \ingroup modules
50  */
52 {
53 public:
54  /**
55  *
56  */
58 
59  /**
60  *
61  */
62  virtual ~WMOpenIGTLinkSender();
63 
64  /**
65  * Gives back the name of this module.
66  * \return the module's name.
67  */
68  virtual const std::string getName() const;
69 
70  /**
71  * Gives back a description of this module.
72  * \return description to module.
73  */
74  virtual const std::string getDescription() const;
75 
76  /**
77  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
78  * should never be initialized or modified in some other way. A simple new instance is required.
79  *
80  * \return the prototype used to create every module in OpenWalnut.
81  */
82  virtual std::shared_ptr< WModule > factory() const;
83 
84  /**
85  * Get the icon for this module in XPM format.
86  *
87  * \return The icon.
88  */
89  virtual const char** getXPMIcon() const;
90 
91 protected:
92  /**
93  * Entry point after loading the module. Runs in separate thread.
94  */
95  virtual void moduleMain();
96 
97  /**
98  * Initialize the connectors this module is using.
99  */
100  virtual void connectors();
101 
102  /**
103  * Initialize the properties for this module.
104  */
105  virtual void properties();
106 
107  /**
108  * Initialize requirements for this module.
109  */
110  virtual void requirements();
111 
112 
113 private:
114  /**
115  * input for data to send
116  */
117  std::shared_ptr < WModuleInputData < WDataSetScalar > > m_input;
118 
119  /**
120  * output of received data
121  */
122  std::shared_ptr < WModuleOutputData < WDataSetScalar > > m_output;
123 
124  /**
125  * A condition used to notify about changes in several properties
126  */
127  std::shared_ptr < WCondition > m_propCondition;
128 
129  /**
130  * hostname to connect to
131  */
132  WPropString m_hostname;
133 
134  /**
135  * port to listen on or to connect to
136  */
137  WPropInt m_port;
138 
139  WPropDouble m_xPos; //!< x position of the slice
140 
141  WPropDouble m_yPos; //!< y position of the slice
142 
143  WPropDouble m_zPos; //!< z position of the slice
144 
145  /**
146  * whether we connect to the remote host or just listen
147  */
148  //WPropBool m_propListenOnPort;
149 
150  /**
151  * List of selections to pick whether to act as an TCPIP server or as an TCPIP client,
152  * i.e., whether to listen on a port for incoming connections
153  * or whether to connect actively to a remote host.
154  */
155  std::shared_ptr < WItemSelection > m_propServerOrClientSelections;
156 
157  /**
158  * Pick whether to act as an TCPIP server or as an TCPIP client,
159  * i.e., whether to listen on a port for incoming connections
160  * or whether to connect actively to a remote host.
161  */
162  WPropSelection m_propServerOrClient;
163 
164  /**
165  * Activation status of the server
166  */
167  WPropBool m_propActive;
168 
169 
170  /**
171  * Check CRC
172  */
173  WPropBool m_propCheckCRC;
174 
175  /**
176  * whether we connect to the remote host or just listen
177  */
178  //WPropBool m_propConnectToRemote;
179 };
180 
181 #endif // WMOPENIGTLINK_H
This module provides an interface to OpenIGTLink, a protocol to exchange data remotely over IP networ...
Definition: WMOpenIGTLink.h:52
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input
input for data to send
WPropDouble m_xPos
x position of the slice
std::shared_ptr< WItemSelection > m_propServerOrClientSelections
whether we connect to the remote host or just listen
virtual void requirements()
Initialize requirements for this module.
virtual void moduleMain()
Entry point after loading the module.
WPropString m_hostname
hostname to connect to
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
WPropInt m_port
port to listen on or to connect to
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual void connectors()
Initialize the connectors this module is using.
WPropDouble m_yPos
y position of the slice
WPropBool m_propCheckCRC
Check CRC.
virtual const std::string getDescription() const
Gives back a description of this module.
WPropSelection m_propServerOrClient
Pick whether to act as an TCPIP server or as an TCPIP client, i.e., whether to listen on a port for i...
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
WPropDouble m_zPos
z position of the slice
WPropBool m_propActive
Activation status of the server.
virtual const std::string getName() const
Gives back the name of this module.
virtual void properties()
Initialize the properties for this module.
std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output
output of received data
Class representing a single module of OpenWalnut.
Definition: WModule.h:72