Difference between revisions of "OpenIGTLink/ProtocolV2/Type/Bind"

From NAMIC Wiki
Jump to: navigation, search
 
(29 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[OpenIGTLink/ProtocolV2/Draft | << Version 2 Draft Page]]
+
[[OpenIGTLink/ProtocolV2/Index | << Version 2 Index Page]]
  
 
=Summary=
 
=Summary=
Bind message format is designed to bind any OpenIGTLink messages into a single message. This message format is useful, when one needs to care about synchronization of multiple data (e.g. multi-channel sensors), or sending associative array (pairs of key string and value). The bind message format consists of the bind header section, the name table section and the data section.  
+
Bind message format is designed to bind any OpenIGTLink messages into a single message. Messages bound in a BIND message are called 'child messages.'
 +
The BIND message format is useful, when one needs to care about synchronization of multiple messages (e.g. multi-channel sensors), or sending associative array (pairs of key string and value). The bind message format consists of the bind header section, which contains types and sizes of child messages, the child message name table section, and the child message body section.
  
 
=Message Types=
 
=Message Types=
Line 12: Line 13:
 
| align="left" style="background:#e0e0e0;" | Description
 
| align="left" style="background:#e0e0e0;" | Description
 
|-
 
|-
| align="left" | NELEMENTS
+
| align="left" | NCMESSAGES
 
| align="left" | uint16
 
| align="left" | uint16
| align="left" | Number of elements
+
| align="left" | Number of child messages
 
|-
 
|-
 
| colspan=3 align="left" style="background:#e0e0e0;" |Bind Header Section  
 
| colspan=3 align="left" style="background:#e0e0e0;" |Bind Header Section  
Line 20: Line 21:
 
| align="left" | TYPE 0
 
| align="left" | TYPE 0
 
| align="left" | char[12]
 
| align="left" | char[12]
| align="left" | Data type (OpenIGTLink Device Type string)
+
| align="left" | Data type (OpenIGTLink Device Type string) for child message 0
|-
 
| align="left" | NAMELEN 0
 
| align="left" | uint 8
 
| align="left" | Name length
 
 
|-
 
|-
 
| align="left" | DATA SIZE 0
 
| align="left" | DATA SIZE 0
 
| align="left" | uint 64
 
| align="left" | uint 64
| align="left" | Data size
+
| align="left" | Data size for child message 0
 
|-
 
|-
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
|-
 
|-
| align="left" | TYPE (NELEMENTS-1)
+
| align="left" | TYPE (NCMESSAGES-1)
 
| align="left" | char[12]
 
| align="left" | char[12]
| align="left" | Data type (OpenIGTLink Device Type string)
+
| align="left" | Data type (OpenIGTLink Device Type string) for child message (NCMESSAGES-1)
 
|-
 
|-
| align="left" | NAMELEN (NELEMENTS-1)
+
| align="left" | DATA SIZE (NCMESSAGES-1)
| align="left" | uint 8
+
| align="left" | uint 64
| align="left" | Name length
+
| align="left" | Data size for child message (NCMESSAGES-1)
 
|-
 
|-
| align="left" | DATA SIZE  (NELEMENTS-1)
+
| colspan=3 align="left" style="background:#e0e0e0;" |NAME Table Section (NULL-separated values)
| align="left" | uint 64
 
| align="left" | Data size
 
 
|-
 
|-
| colspan=3 align="left" style="background:#e0e0e0;" |NAME Table Section
+
| align="left" | NAME_TABLE_SIZE
 +
| align="left" | uint16
 +
| align="left" | Size of name table (including the padding)
 
|-
 
|-
 
| align="left" | NAME 0
 
| align="left" | NAME 0
| align="left" | char[NAMELEN]
+
| align="left" | char[*]
| align="left" | Name
+
| align="left" | Name for child message 0
 +
|-
 +
| align="left" | (null)
 +
| align="left" | uint8
 +
| align="left" | separator
 
|-
 
|-
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
|-
 
|-
| align="left" | NAME (NELEMENTS-1)
+
| align="left" | NAME (NCMESSAGES-1)
| align="left" | char[NAMELEN (NELEMENTS-1)]
+
| align="left" | char[*]
| align="left" | Name
+
| align="left" | Name for child message (NCMESSAGES-1)
 +
|-
 +
| align="left" | (null)
 +
| align="left" | uint8
 +
| align="left" | separator
 
|-
 
|-
 
| align="left" | Padding*
 
| align="left" | Padding*
Line 63: Line 68:
 
|-
 
|-
 
| align="left" | DATA 0
 
| align="left" | DATA 0
| align="left" | TYPE 0 [ SIZE 0 ]
+
| align="left" | TYPE 0 ( SIZE 0 )
| align="left" | Data array
+
| align="left" | Data array for child message 0
 +
|-
 +
| align="left" | (Padding*)
 +
| align="left" | uint8 or none
 +
| align="left" | padding to align DATA with WORD
 
|-
 
|-
 
| align="left" | DATA 1
 
| align="left" | DATA 1
| align="left" | TYPE 1 [ SIZE 1 ]
+
| align="left" | TYPE 1 ( SIZE 1 )
| align="left" | Data array
+
| align="left" | Data array for child message 1
 +
|-
 +
| align="left" | (Padding*)
 +
| align="left" | uint8 or none
 +
| align="left" | padding to align DATA with WORD
 
|-
 
|-
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
|-
 
|-
| align="left" | DATA (NELEMENTS-1)
+
| align="left" | DATA (NCMESSAGES-1)
| align="left" | TYPE (NELEMENTS-1) [SIZE (NELEMENTS -1)]
+
| align="left" | TYPE NCMESSAGE-1 (SIZE NCMESSAGE-1)
| align="left" | Data array
+
| align="left" | Data array for child message NCMESSAGE-1
 +
|-
 +
| align="left" | Padding*
 +
| align="left" | uint8 or none
 +
| align="left" | padding to align DATA with WORD
 
|-
 
|-
 
|}
 
|}
 +
*Padding field is inserted only if the previous field does not aligned with WORD border.
  
In C/C++, the size of padding is determined by:
+
<font color="red">Feb 3, 2011: Padding fields are inserted in the data section. </font>
((NAMELEN0 + NAMELEN1 + ... ) % 2 == 0) ? 0 : 1
 
  
 
==GET_BIND==
 
==GET_BIND==
Line 90: Line 107:
 
| align="left style="background:#e0e0e0;" | Description
 
| align="left style="background:#e0e0e0;" | Description
 
|-
 
|-
| colspan=3 align="left" style="background:#e0e0e0;" |Bind Header Section
+
| align="left" | NCMESSAGES
|-
 
| align="left" | NELEMENTS
 
 
| align="left" | uint16
 
| align="left" | uint16
 
| align="left" | Number of elements
 
| align="left" | Number of elements
 +
|-
 +
| colspan=3 align="left" style="background:#e0e0e0;" |Bind Header Section
 
|-
 
|-
 
| align="left" | TYPE 0
 
| align="left" | TYPE 0
Line 100: Line 117:
 
| align="left" | Data type (OpenIGTLink device type string)
 
| align="left" | Data type (OpenIGTLink device type string)
 
|-
 
|-
| align="left" | NAMELEN 0
+
| colspan=3 align="left" style="background:#f0f0f0;"|...
 +
|-
 +
| align="left" | TYPE (NCMESSAGES-1)
 +
| align="left" | char[12]
 +
| align="left" | Data type (OpenIGTLink device type string)
 +
|-
 +
| colspan=3 align="left" style="background:#e0e0e0;" |NAME Table
 +
|-
 +
| align="left" | NAME_TABLE_SIZE
 +
| align="left" | uint16
 +
| align="left" | Size of name table (including the padding)
 +
|-
 +
| align="left" | NAME 0
 +
| align="left" | char[NAMELEN]
 +
| align="left" | Name
 +
|-
 +
| align="left" | NULL
 +
| align="left" | uint 8
 +
| align="left" | Separator
 +
|-
 +
| colspan=3 align="left" style="background:#f0f0f0;"|...
 +
|-
 +
| align="left" | NAME (NCMESSAGES-1)
 +
| align="left" | char[NAMELEN (NCMESSAGES-1)]
 +
| align="left" | Name
 +
|-
 +
| align="left" | NULL
 
| align="left" | uint 8
 
| align="left" | uint 8
| align="left" | Name length
+
| align="left" | Separator
 +
|-
 +
|}
 +
 
 +
==STT_BIND==
 +
GET_BIND is used to request the receiver for associative array data. If a GET_BIND message does not have a body, it requests all data.
 +
 
 +
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
|-
 
|-
| align="left" | SIZE 0
+
| align="left" style="background:#e0e0e0;" | Data
| align="left" | uint 16
+
| align="left" style="background:#e0e0e0;" | Type
| align="left" | Data length
+
| align="left" style="background:#e0e0e0;" | Description
 +
|-
 +
| align="left" | RESOL
 +
| align="left" | uint64
 +
| align="left" | Minimum interval between message (ns). Same format as [[OpenIGTLink/Timestamp|TimeStamp]]
 +
|-
 +
|}
 +
 
 +
<center>or </center>
 +
 
 +
 
 +
{| border="1" cellpadding="5" cellspacing="0" align="center"
 +
|-
 +
| align="left style="background:#e0e0e0;" | Data
 +
| align="left style="background:#e0e0e0;" | Type
 +
| align="left style="background:#e0e0e0;" | Description
 +
|-
 +
| align="left" | RESOL
 +
| align="left" | uint64
 +
| align="left" | Minimum interval between message (ns). Same format as [[OpenIGTLink/Timestamp|TimeStamp]]
 +
|-
 +
| align="left" | NCMESSAGES
 +
| align="left" | uint16
 +
| align="left" | Number of elements
 +
|-
 +
| colspan=3 align="left" style="background:#e0e0e0;" |Bind Header Section
 +
|-
 +
| align="left" | TYPE 0
 +
| align="left" | char[12]
 +
| align="left" | Data type (OpenIGTLink device type string)
 
|-
 
|-
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
|-
 
|-
| align="left" | TYPE (NELEMENTS-1)
+
| align="left" | TYPE (NCMESSAGES-1)
| align="left" | uint8
+
| align="left" | char[12]
 
| align="left" | Data type (0: string, 1: scalar, 2: vector)
 
| align="left" | Data type (0: string, 1: scalar, 2: vector)
 
|-
 
|-
| align="left" | NAMELEN (NELEMENTS-1)
+
| colspan=3 align="left" style="background:#e0e0e0;" |NAME Table Section (NULL-separated values)
| align="left" | uint 8
 
| align="left" | Name length
 
|-
 
| align="left" | SIZE (NELEMENTS-1)
 
| align="left" | uint 16
 
| align="left" | Data length
 
 
|-
 
|-
| colspan=3 align="left" style="background:#e0e0e0;" |NAME Table
+
| align="left" | NAME_TABLE_SIZE
 +
| align="left" | uint16
 +
| align="left" | Size of name table (including the padding)
 
|-
 
|-
 
| align="left" | NAME 0
 
| align="left" | NAME 0
| align="left" | char[NAMELEN]
+
| align="left" | char[*]
 
| align="left" | Name
 
| align="left" | Name
 +
|-
 +
| align="left" | (null)
 +
| align="left" | uint8
 +
| align="left" | separator
 
|-
 
|-
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
| colspan=3 align="left" style="background:#f0f0f0;"|...
 
|-
 
|-
| align="left" | NAME (NELEMENTS-1)
+
| align="left" | NAME (NCMESSAGES-1)
| align="left" | char[NAMELEN (NELEMENTS-1)]
+
| align="left" | char[*]
 
| align="left" | Name
 
| align="left" | Name
 +
|-
 +
| align="left" | (null)
 +
| align="left" | uint8
 +
| align="left" | separator
 
|-
 
|-
 
|}
 
|}
  
==STT_AARRAY==
+
==STP_BIND==
Same as GET_AARRAY.
+
 
 +
{| border="1" cellpadding="5" cellspacing="0" align="center"
 +
|-
 +
| align="left style="background:#e0e0e0;" | Data
 +
| align="left style="background:#e0e0e0;" | Type
 +
| align="left style="background:#e0e0e0;" | Description
 +
|-
 +
|}
  
==STP_AARRAY==
+
==RTS_BIND==
  
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
Line 146: Line 236:
 
| align="left style="background:#e0e0e0;" | Type
 
| align="left style="background:#e0e0e0;" | Type
 
| align="left style="background:#e0e0e0;" | Description
 
| align="left style="background:#e0e0e0;" | Description
 +
|-
 +
| align="left" | Status
 +
| align="left" | 8 bit unsigned
 +
| align="left" | 0: Success 1: Error
 
|-
 
|-
 
|}
 
|}
 
==RTS_AARRAY==
 
  
 
=Implementations=
 
=Implementations=
The AARRAY message type is implemented in the following source code.
 
<!--
 
*[http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlTrackingDataMessage.h igtlTrackingDataMessage.h]
 
*[http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlTrackingDataMessage.cxx igtlTrackingDataMessage.cxx]
 
-->
 
  
 
=Contributors=
 
=Contributors=
Junichi Tokuda, Yuichiro Hayashi
+
Junichi Tokuda
  
 
=Comments=
 
=Comments=

Latest revision as of 04:44, 30 November 2011

Home < OpenIGTLink < ProtocolV2 < Type < Bind

<< Version 2 Index Page

Summary

Bind message format is designed to bind any OpenIGTLink messages into a single message. Messages bound in a BIND message are called 'child messages.' The BIND message format is useful, when one needs to care about synchronization of multiple messages (e.g. multi-channel sensors), or sending associative array (pairs of key string and value). The bind message format consists of the bind header section, which contains types and sizes of child messages, the child message name table section, and the child message body section.

Message Types

BIND

Data Type Description
NCMESSAGES uint16 Number of child messages
Bind Header Section
TYPE 0 char[12] Data type (OpenIGTLink Device Type string) for child message 0
DATA SIZE 0 uint 64 Data size for child message 0
...
TYPE (NCMESSAGES-1) char[12] Data type (OpenIGTLink Device Type string) for child message (NCMESSAGES-1)
DATA SIZE (NCMESSAGES-1) uint 64 Data size for child message (NCMESSAGES-1)
NAME Table Section (NULL-separated values)
NAME_TABLE_SIZE uint16 Size of name table (including the padding)
NAME 0 char[*] Name for child message 0
(null) uint8 separator
...
NAME (NCMESSAGES-1) char[*] Name for child message (NCMESSAGES-1)
(null) uint8 separator
Padding* uint8 or none padding to align DATA with WORD
Data Section
DATA 0 TYPE 0 ( SIZE 0 ) Data array for child message 0
(Padding*) uint8 or none padding to align DATA with WORD
DATA 1 TYPE 1 ( SIZE 1 ) Data array for child message 1
(Padding*) uint8 or none padding to align DATA with WORD
...
DATA (NCMESSAGES-1) TYPE NCMESSAGE-1 (SIZE NCMESSAGE-1) Data array for child message NCMESSAGE-1
Padding* uint8 or none padding to align DATA with WORD
  • Padding field is inserted only if the previous field does not aligned with WORD border.

Feb 3, 2011: Padding fields are inserted in the data section.

GET_BIND

GET_BIND is used to request the receiver for associative array data. If a GET_BIND message does not have a body, it requests all data.

Data Type Description
NCMESSAGES uint16 Number of elements
Bind Header Section
TYPE 0 char[12] Data type (OpenIGTLink device type string)
...
TYPE (NCMESSAGES-1) char[12] Data type (OpenIGTLink device type string)
NAME Table
NAME_TABLE_SIZE uint16 Size of name table (including the padding)
NAME 0 char[NAMELEN] Name
NULL uint 8 Separator
...
NAME (NCMESSAGES-1) char[NAMELEN (NCMESSAGES-1)] Name
NULL uint 8 Separator

STT_BIND

GET_BIND is used to request the receiver for associative array data. If a GET_BIND message does not have a body, it requests all data.

Data Type Description
RESOL uint64 Minimum interval between message (ns). Same format as TimeStamp
or


Data Type Description
RESOL uint64 Minimum interval between message (ns). Same format as TimeStamp
NCMESSAGES uint16 Number of elements
Bind Header Section
TYPE 0 char[12] Data type (OpenIGTLink device type string)
...
TYPE (NCMESSAGES-1) char[12] Data type (0: string, 1: scalar, 2: vector)
NAME Table Section (NULL-separated values)
NAME_TABLE_SIZE uint16 Size of name table (including the padding)
NAME 0 char[*] Name
(null) uint8 separator
...
NAME (NCMESSAGES-1) char[*] Name
(null) uint8 separator

STP_BIND

Data Type Description

RTS_BIND

Data Type Description
Status 8 bit unsigned 0: Success 1: Error

Implementations

Contributors

Junichi Tokuda

Comments