Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtl_lbmeta.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: OpenIGTLink Library
4  Module: $RCSfile$
5  Language: C
6  Date: $Date: 2009-11-17 22:53:00 -0500 (Tue, 17 Nov 2009) $
7  Version: $Revision: 5366 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notices for more information.
14 
15 =========================================================================*/
16 
17 #ifndef __IGTL_LBMETA_H
18 #define __IGTL_LBMETA_H
19 
20 #include "igtl_win32header.h"
21 #include "igtl_util.h"
22 #include "igtl_types.h"
23 
24 #define IGTL_LBMETA_ELEMENT_SIZE 116
25 
26 #define IGTL_LBMETA_LEN_NAME 64
27 #define IGTL_LBMETA_LEN_DEVICE_NAME 20
28 #define IGTL_LBMETA_LEN_OWNER 20
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Label meta data in OpenIGTLinik protocol
36  *
37  * LBMETA is a data type to send a list of label image data available in a server.
38  * In OpenIGTLink protocol, actual label data is transfered as an IMAGE message.
39  * LBMETA message lets the receiving client know which IMAGE data are available
40  * as label maps.
41  * Multiple labels in a LBMETA message can point the same IMAGE message, if there
42  * are multiple lables are recoreded in a single IMAGE mesage. For example, given
43  * the following label map as IMAGE data with name "LableImage1":
44  *
45  * 0 0 0 1 0 0 value | name / description
46  * 2 0 1 1 1 0 --------+----------------------------
47  * 2 2 1 1 1 0 0 | None
48  * 2 2 2 1 0 0 1 | Liver
49  * 2 2 2 2 0 0 2 | Kidney
50  *
51  * To send the label information recorded in "LabelImage1," one can create
52  * a following LBMETA message:
53  *
54  * DATA | Contents
55  * ---------------+---------------------------
56  * NAME 1 | Liver
57  * IMAGE NAME 1 | LabelImage
58  * Labe l | 1
59  * RGBA 1 | 0xFF0000
60  * SIZE 1 | (6, 5, 1)
61  * OWNER 1 |
62  * --------------+---------------------------
63  * NAME 2 | Kidney
64  * IMAGE NAME 2 | LabelImage
65  * Labe 2 | 2
66  * RGBA 2 | 0xFF2222
67  * SIZE 2 | (6, 5, 1)
68  * OWNER 2 |
69  * --------------+---------------------------
70  *
71  * ... ....
72  *
73  * --------------+---------------------------
74  *
75  * The client determins the number of image meta by the size of the body included
76  * in the message header (see igtl_lbmeta_getdata_n() macro).
77  */
78 
79 #pragma pack(1) /* For 1-byte boundary in memroy */
80 
81 typedef struct {
82  char name[IGTL_LBMETA_LEN_NAME]; /* name / description */
83  char device_name[IGTL_LBMETA_LEN_DEVICE_NAME]; /* device name to query the IMAGE */
84  igtl_uint8 label; /* label */
85  igtl_uint8 reserved;
86  igtl_uint8 rgba[4]; /* Color in RGBA. default: (0, 0, 0, 0) */
87  igtl_uint16 size[3]; /* Number of pixels in each direction */
88  char owner[IGTL_LBMETA_LEN_OWNER];/* Device name of the owner image. (can be empty) */
90 
91 #pragma pack()
92 
93 
94 /*
95  * Macros for label meta data size
96  *
97  * igtl_lbmeta_get_data_size(n) calculates the size of body based on the number
98  * of images.The size of body is used in the message header.
99  * igtl_lbmeta_get_data_n(size) calculates the number of images in the body, based on
100  * the body size. This function may be used when a client program parses LBMETA message.
101  *
102  */
103 
104 #define igtl_lbmeta_get_data_size(n) ((n) * IGTL_LBMETA_ELEMENT_SIZE)
105 #define igtl_lbmeta_get_data_n(size) ((size) / IGTL_LBMETA_ELEMENT_SIZE)
106 
107 
108 /*
109  * Byte order conversion for the image meta data
110  *
111  * This function converts endianness of each member variable
112  * in igtl_lbmeta_element from host byte order to network byte order,
113  * or vice versa.
114  */
115 
117 
118 
119 /*
120  * CRC calculation
121  *
122  * This function calculates CRC of image meta data body.
123  *
124  */
125 
126 igtl_uint64 igtl_export igtl_lbmeta_get_crc(igtl_lbmeta_element* metalist, int nitem);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* __IGTL_LBMETA_H */
133 
134 
135 

Generated at Thu Mar 20 2014 16:32:06 for OpenIGTLink by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2000