TubeTK/OpenIGTLink: Difference between revisions
Jamie.snape (talk | contribs) No edit summary |
|||
(26 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
=Introduction= | =Introduction= | ||
= OpenIGTLink CLI Application = | OpenIGTLink is a communication protocol designed to work on the TCP/IP application layer to handle image, tracking data, transform, device control and monitoring command, and other user-defined data types. Example use cases | ||
# '''Interfacing a tracking device''': A computer running IGSTK based navigation application and a computer running Slicer are connected using a network cable. The IGSTK application gathers pose information of surgical instruments and packages them in OpenIGTLink message format and then sends the data over the network connection using OpenIGTLink protocol to the computer running Slicer for visualization and/or further processing | |||
# '''Integration with a commercial navigation system''': A computer running tubetk based vessel segmentation application is connected to a BrainLab VectorVision machine using a network cable. VectorVisison fetches Ultrasound images, packages them as OpenIGTLink image message and sends them to the computer running the tubetk application. | |||
=Description= | |||
OpenIGTLink is designed for use in the application layer on the TCP/IP stack. A message, the minimum data unit of OpenIGTLInk protocol contains all the information necessary for interpretation by the receiver. The message begins with a 58-byte header section that contains protocol version, message type, device name, time stamp, body size and cyclic redundancy check. The body section varies according to the message type being sent. | |||
== Typical Workflow == | |||
=== Client === | |||
# Establish connection with server side | |||
# Generate OpenIGTLink message (data-to-be-sent ) and package it as an OpenIGTLink format. | |||
# Send data through TCP/IP socket connection | |||
=== Server side === | |||
# Create a server socket and wait for the client to connect | |||
# When connection is established with a client, get into a "Ready" state to start receiving messages. | |||
# When a message is received, error check and unpack the header and identify the message type and prepare to receive the message body | |||
# Receive, error check, unpack and parse the message body according to the message type. | |||
== Versions == | |||
There are two versions of the protocol available. | |||
=== Version 1 === | |||
Message types | |||
# Transform | |||
# Image | |||
# Position | |||
# Status message | |||
=== Version 2 === | |||
In addition to the above message types, Version 2 provides a simple querying scheme. | |||
# Client can request the server side to send a data contained in a single message | |||
# Client can start and stop data streaming from the server | |||
=== Implementation === | |||
Surgical Navigation and Robotics Lab at BWH has developed a C++ library implementation of this protocol. The library is composed of | |||
# C-based library defining structures and utility functions to serialize data into OpenIGTLinkMessage | |||
# A set of high-level C++ classes wrapping the C-based library that provide a safer and more convenient way to implement OpenIGTLink messaging function into software | |||
# Multi-platform C++ classes to handle sockets and threads. | |||
Version 1 | |||
http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink | |||
Version 2 | |||
http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/ | |||
= OpenIGTLink CLI Application in TubeTK= | |||
# [http://gitorious.org/tubetk/tubetk/trees/master/Applications/CLI/SendPositionMessageUsingOpenIGTLink Server App] | |||
# [http://gitorious.org/tubetk/tubetk/trees/master/Applications/CLI/ReceivePositionMessageUsingOpenIGTLink Client App] | |||
How to run these CLIs | |||
1) Run first the Send CLI with a port number | |||
./TubeTK-Build/lib/TubeTK/Plugins/SendPositionMessageUsingOpenIGTLink 18000 | |||
Position information generation interval: 100 | |||
<br> | |||
Waiting for connection... | |||
<br> | |||
Waiting for connection... | |||
<br> | |||
Waiting for connection... | |||
<br> | |||
This CLI has created a socket connection and waiting for a client to request data transfer. So, while this is running, open another terminal and run the Receive CLI | |||
<br> | |||
2) Run the Receive CLI with the exact port number and localhost hostname as follows | |||
<br> | |||
./TubeTK-Build/lib/TubeTK/Plugins/ReceivePositionMessageUsingOpenIGTLink | |||
18000 localhost | |||
Connected to the server : localhost 18000 | |||
<br> | |||
Receiving POSITION data type. | |||
<br> | |||
position = (50, 0, 50) | |||
<br> | |||
quaternion = (0, 0.666667, 0.57735, 0) | |||
Receiving POSITION data type. | |||
<br> | |||
position = (-20.8073, 45.4649, -20.8073)\ | |||
<br> | |||
quaternion = (0, 0.663336, 0.57735, 0.0665556) | |||
<br> | |||
Receiving POSITION data type. | |||
<br> | |||
position = (-32.6822, -37.8401, -32.6822) | |||
<br> | |||
quaternion = (0, 0.653378, 0.57735, 0.132446) | |||
<br> | |||
=Reference= | =Reference= | ||
#[http://www.na-mic.org/Wiki/index.php/OpenIGTLink NAMIC OpenIGTLink wiki page] | |||
#[http://en.wikipedia.org/wiki/Internet_socket Internet socket] | |||
#[http://net.pku.edu.cn/~course/cs501/2010/code/BSD_Socket.t/sockets.pdf Socket Programming C++] | |||
#[http://www.doc.ic.ac.uk/~ih/doc/pc_conn/tcpip/intro/intro0.html TCP/IP Introduction] | |||
#[http://en.wikipedia.org/wiki/Berkeley_sockets BSD socket] | |||
#[http://www.commontk.org/index.php/Documentation/Messaging CTK effort ] | |||
[[Category:TubeTK Modules|OpenIGTLink]] |
Latest revision as of 18:56, 26 July 2013
Introduction
OpenIGTLink is a communication protocol designed to work on the TCP/IP application layer to handle image, tracking data, transform, device control and monitoring command, and other user-defined data types. Example use cases
- Interfacing a tracking device: A computer running IGSTK based navigation application and a computer running Slicer are connected using a network cable. The IGSTK application gathers pose information of surgical instruments and packages them in OpenIGTLink message format and then sends the data over the network connection using OpenIGTLink protocol to the computer running Slicer for visualization and/or further processing
- Integration with a commercial navigation system: A computer running tubetk based vessel segmentation application is connected to a BrainLab VectorVision machine using a network cable. VectorVisison fetches Ultrasound images, packages them as OpenIGTLink image message and sends them to the computer running the tubetk application.
Description
OpenIGTLink is designed for use in the application layer on the TCP/IP stack. A message, the minimum data unit of OpenIGTLInk protocol contains all the information necessary for interpretation by the receiver. The message begins with a 58-byte header section that contains protocol version, message type, device name, time stamp, body size and cyclic redundancy check. The body section varies according to the message type being sent.
Typical Workflow
Client
- Establish connection with server side
- Generate OpenIGTLink message (data-to-be-sent ) and package it as an OpenIGTLink format.
- Send data through TCP/IP socket connection
Server side
- Create a server socket and wait for the client to connect
- When connection is established with a client, get into a "Ready" state to start receiving messages.
- When a message is received, error check and unpack the header and identify the message type and prepare to receive the message body
- Receive, error check, unpack and parse the message body according to the message type.
Versions
There are two versions of the protocol available.
Version 1
Message types
- Transform
- Image
- Position
- Status message
Version 2
In addition to the above message types, Version 2 provides a simple querying scheme.
- Client can request the server side to send a data contained in a single message
- Client can start and stop data streaming from the server
Implementation
Surgical Navigation and Robotics Lab at BWH has developed a C++ library implementation of this protocol. The library is composed of
- C-based library defining structures and utility functions to serialize data into OpenIGTLinkMessage
- A set of high-level C++ classes wrapping the C-based library that provide a safer and more convenient way to implement OpenIGTLink messaging function into software
- Multi-platform C++ classes to handle sockets and threads.
Version 1 http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink
Version 2 http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/
OpenIGTLink CLI Application in TubeTK
How to run these CLIs
1) Run first the Send CLI with a port number
./TubeTK-Build/lib/TubeTK/Plugins/SendPositionMessageUsingOpenIGTLink 18000
Position information generation interval: 100
Waiting for connection...
Waiting for connection...
Waiting for connection...
This CLI has created a socket connection and waiting for a client to request data transfer. So, while this is running, open another terminal and run the Receive CLI
2) Run the Receive CLI with the exact port number and localhost hostname as follows
./TubeTK-Build/lib/TubeTK/Plugins/ReceivePositionMessageUsingOpenIGTLink
18000 localhost
Connected to the server : localhost 18000
Receiving POSITION data type.
position = (50, 0, 50)
quaternion = (0, 0.666667, 0.57735, 0)
Receiving POSITION data type.
position = (-20.8073, 45.4649, -20.8073)\
quaternion = (0, 0.663336, 0.57735, 0.0665556)
Receiving POSITION data type.
position = (-32.6822, -37.8401, -32.6822)
quaternion = (0, 0.653378, 0.57735, 0.132446)