File: polydata.md

package info (click to toggle)
openigtlink 3.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,080 kB
  • sloc: cpp: 20,076; ansic: 6,704; sh: 227; perl: 74; makefile: 46
file content (300 lines) | stat: -rwxr-xr-x 9,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
---
layout: page
title: Specification > PolyData
header: Pages
---
{% include JB/setup %}


## Summary

POLYDATA is used to transfer 3D polygonal data. The message format is designed based on the [POLY DATA format](http://www.vtk.org/VTK/img/file-formats.pdf) defined in VTK file format and equivalent to [VTK's vtkPolyData class](http://noodle.med.yale.edu/vtk5/classvtkPolyData.html). The message also supports dataset attribute field in VTK, including scalars, calar_scalars, vectors, vectors, normals, texture coordinates and tensor, but not lookup table.

## Message Types

### POLYDATA

<table border="1" cellpadding="5" cellspacing="0" align="center">

<tbody><tr>
<td style="background:#e0e0e0;"> Data
</td><td style="background:#e0e0e0;"> Type
</td><td style="background:#e0e0e0;"> Description
</td></tr>
<tr>
<td align="left"> NPOINTS
</td><td align="left"> uint32
</td><td align="left"> Number of points
</td></tr>
<tr>
<td align="left"> NVERTICES
</td><td align="left"> uint32
</td><td align="left"> Number of vertices
</td></tr>
<tr>
<td align="left"> SIZE_VERTICES
</td><td align="left"> uint32
</td><td align="left"> Total size of vertices data
</td></tr>
<tr>
<td align="left"> NLINES
</td><td align="left"> uint32
</td><td align="left"> Number of lines
</td></tr>
<tr>
<td align="left"> SIZE_LINES
</td><td align="left"> uint32
</td><td align="left"> Total size of line data
</td></tr>
<tr>
<td align="left"> NPOLYGONS
</td><td align="left"> uint32
</td><td align="left"> Number of polygons
</td></tr>
<tr>
<td align="left"> SIZE_POLYGONS
</td><td align="left"> uint32
</td><td align="left"> Total size of polygon data
</td></tr>
<tr>
<td align="left"> NTRIANGLE_STRIPS
</td><td align="left"> uint32
</td><td align="left"> Number of triangle strips
</td></tr>
<tr>
<td align="left"> SIZE_TRIANGLE_STRIPS
</td><td align="left"> uint32
</td><td align="left"> Total size of triangle strips data
</td></tr>
<tr>
<td align="left"> NATTRIBUTES
</td><td align="left"> uint32
</td><td align="left"> Number of dataset attributes
</td></tr>
<tr>
<td align="left"> POINTS
</td><td align="left"> float32 * NPOINTS * 3
</td><td align="left"> Coordinates of points (P0x, P0y, P0z, P1x, P1y, P1z, ... P(n-1)x, P(n-1)y, P(n-1)z
</td></tr>
<tr>
<td align="left"> VERTICES
</td><td align="left"> uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
</td><td align="left"> array of vertices ((NPOINTS_0, index_0_0, index_0_1, ....), (NPOINTS_1, index_1_0, index_1_1, ....), ..., (NPOINTS_(N-1), index_(N-1)_0, index_(N-1)_1, ....))
</td></tr>
<tr>
<td align="left"> LINES
</td><td align="left"> uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
</td><td align="left"> array of vertices ((NPOINTS_0, index_0_0, index_0_1, ....), (NPOINTS_1, index_1_0, index_1_1, ....), ..., (NPOINTS_(N-1), index_(N-1)_0, index_(N-1)_1, ....))
</td></tr>
<tr>
<td align="left"> POLYGONS
</td><td align="left"> uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
</td><td align="left"> array of vertices ((NPOINTS_0, index_0_0, index_0_1, ....), (NPOINTS_1, index_1_0, index_1_1, ....), ..., (NPOINTS_(N-1), index_(N-1)_0, index_(N-1)_1, ....))
</td></tr>
<tr>
<td align="left"> TRIANGLE_STRIPS
</td><td align="left"> uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
</td><td align="left"> array of vertices ((NPOINTS_0, index_0_0, index_0_1, ....), (NPOINTS_1, index_1_0, index_1_1, ....), ..., (NPOINTS_(N-1), index_(N-1)_0, index_(N-1)_1, ....))
</td></tr>
<tr>
<td align="left"> TYPE_ATTRIBUTE0
</td><td align="left"> uint16
</td><td align="left"> Type of dataset attribute 0 (including number of components for scalar type)
</td></tr>
<tr>
<td align="left"> NATTRIBUTE0
</td><td align="left"> uint32
</td><td align="left"> Number of data for attribute 0
</td></tr>
<tr>
<td align="left"> TYPE_ATTRIBUTE1
</td><td align="left"> uint16
</td><td align="left"> Type of dataset attribute 1 (including number of components for scalar type)
</td></tr>
<tr>
<td align="left"> NATTRIBUTE1
</td><td align="left"> uint32
</td><td align="left"> Number of data for attribute1
</td></tr>
<tr>
<td align="left"> ...
</td><td align="left"> ...
</td><td align="left"> ...
</td></tr>
<tr>
<td align="left"> TYPE_ATTRIBUTE(NATTRIBUTES-1)
</td><td align="left"> uint16
</td><td align="left"> Type of dataset attribute 1 (including number of components for scalar type)
</td></tr>
<tr>
<td align="left"> NATTRIBUTE(NATTRIBUTES-1)
</td><td align="left"> uint32
</td><td align="left"> Number of data for attribute2
</td></tr>
<tr>
<td align="left"> NAME_ATTRIBUTE0
</td><td align="left"> char * (name length)
</td><td align="left"> Name of attribute 0
</td></tr>
<tr>
<td align="left"> (null)
</td><td align="left"> char
</td><td align="left"> (null)
</td></tr>
<tr>
<td align="left"> NAME_ATTRIBUTE1
</td><td align="left"> char * (name length)
</td><td align="left"> Name of attribute 1
</td></tr>
<tr>
<td align="left"> (null)
</td><td align="left"> char
</td><td align="left"> (null)
</td></tr>
<tr>
<td align="left"> ...
</td><td align="left"> ...
</td><td align="left"> ...
</td></tr>
<tr>
<td align="left"> NAME_ATTRIBUTE(NATTRIBUTES-1)
</td><td align="left"> char * (name length)
</td><td align="left"> Name of attribute (NATTRIBUTES-1)
</td></tr>
<tr>
<td align="left"> (null)
</td><td align="left"> char
</td><td align="left"> (null)
</td></tr>
<tr>
<td align="left"> (Padding)
</td><td align="left"> char or 0
</td><td align="left"> Padding (inserted if (NAMESIZE_ATTRIBUTE0+1+NAMESIZE_ATTRIBUTE1+1+...NAMESIZE_ATTRIBUTE(NATTRIBUTES-1)+1)&nbsp;% 2 == 1)
</td></tr>
<tr>
<td align="left"> ATTRIBUTE0
</td><td align="left"> SIZE_ATTRIBUTE0 * (number of components) * (float32)
</td><td align="left"> Actual attribute data
</td></tr>
<tr>
<td align="left"> ATTRIBUTE1
</td><td align="left"> NATTRIBUTE0 * (number of components) * (float32)
</td><td align="left"> Actual attribute data
</td></tr>
<tr>
<td align="left"> ...
</td><td align="left"> ...
</td><td align="left"> ...
</td></tr>
<tr>
<td align="left"> ATTRIBUTE(NATTRIBUTES-1)
</td><td align="left"> NATTRIBUTE(NATTRIBUTES-1) * (number of components) * (float32)
</td><td align="left"> Actual attribute data
</td></tr>
</tbody></table>


* Values for TYPE_ATTRIBUTE (16-bit)
  * 0-7 bit: Attribute Type:
    * 0x00: POINT_DATA / Scalars
    * 0x01: POINT_DATA / Vectors
    * 0x02: POINT_DATA / Normals
    * 0x03: POINT_DATA / Tensors
    * 0x04: POINT_DATA / RGBA
    * 0x10: CELL_DATA / Scalars
    * 0x11: CELL_DATA / Vectors
    * 0x12: CELL_DATA / Normals
    * 0x13: CELL_DATA / Tensors
    * 0x14: CELL_DATA / RGBA
  * 8-15 bit: Number of components -- must be 3 for Vectors and Normal, 9 for Tensor, 4 for RGBA.
* Maximum length for attribute name is 255
* If there are a pair of scalar and RGBA data with the same name and type (either POINT or CELL), those are used as scalar values and a look up table.
  * elements in RGBA data must be in the rage of \[0.0, 1.0\]

### GET_POLYDATA

<table border="1" cellpadding="5" cellspacing="0" align="center">

<tbody><tr>
<td style="background:#e0e0e0;"> Data
</td><td style="background:#e0e0e0;"> Type
</td><td style="background:#e0e0e0;"> Description
</td></tr>
</tbody></table>

### STT_POLYDATA

<table border="1" cellpadding="5" cellspacing="0" align="center">

<tbody><tr>
<td align="left" style="background:#e0e0e0;"> Data
</td><td align="left" style="background:#e0e0e0;"> Type
</td><td align="left" style="background:#e0e0e0;"> Description
</td></tr>
</tbody></table>

or 

<table border="1" cellpadding="5" cellspacing="0" align="center">

<tbody><tr>
<td align="left" style="background:#e0e0e0;"> Data
</td><td align="left" style="background:#e0e0e0;"> Type
</td><td align="left" style="background:#e0e0e0;"> Description
</td></tr>
<tr>
<td align="left"> RESOL
</td><td align="left"> uint64
</td><td align="left"> Minimum interval between message (ns). Same format as <a href="/Wiki/index.php/OpenIGTLink/Timestamp" title="OpenIGTLink/Timestamp">TimeStamp</a>
</td></tr>
</tbody></table>

### STP_POLYDATA

<table border="1" cellpadding="5" cellspacing="0" align="center">

<tbody><tr>
<td style="background:#e0e0e0;"> Data
</td><td style="background:#e0e0e0;"> Type
</td><td style="background:#e0e0e0;"> Description
</td></tr>
</tbody></table>


### RTS_POLYDATA


<table border="1" cellpadding="5" cellspacing="0" align="center">

<tbody><tr>
<td style="background:#e0e0e0;"> Data
</td><td style="background:#e0e0e0;"> Type
</td><td style="background:#e0e0e0;"> Description
</td></tr>
<tr>
<td align="left"> Status
</td><td align="left"> 8 bit unsigned
</td><td align="left"> 0: Success 1: Error
</td></tr>
</tbody></table>

## Implementations

The POLYDATA message type is implemented in the following source code.

* [igtlPolyDataMessage.h](https://github.com/openigtlink/OpenIGTLink/blob/master/Source/igtlPolyDataMessage.h)
* [igtlPolyDataMessage.cxx](https://github.com/openigtlink/OpenIGTLink/blob/master/Source/igtlPolyDataMessage.cxx)



## Contributors

* Junichi Tokuda