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

From NAMIC Wiki
Jump to: navigation, search
 
(40 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=
POLYDATA is used to transfer 3D polygon model data. The message format is designed based on the [http://www.vtk.org/VTK/img/file-formats.pdf POLY data defined in VTK file format].
+
POLYDATA is used to transfer 3D polygonal data. The message format is designed based on the [http://www.vtk.org/VTK/img/file-formats.pdf POLY DATA format defined in VTK file format] and equivalent to [http://noodle.med.yale.edu/vtk5/classvtkPolyData.html VTK's vtkPolyData class]. 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=
 
=Message Types=
Line 14: Line 13:
 
| align="left style="background:#e0e0e0;" | Description
 
| align="left style="background:#e0e0e0;" | Description
 
|-
 
|-
 +
| align="left" | NPOINTS
 +
| align="left" | uint32
 +
| align="left" | Number of points
 +
|-
 +
| align="left" | NVERTICES
 +
| align="left" | uint32
 +
| align="left" | Number of vertices
 +
|-
 +
| align="left" | SIZE_VERTICES
 +
| align="left" | uint32
 +
| align="left" | Total size of vertices data
 +
|-
 +
| align="left" | NLINES
 +
| align="left" | uint32
 +
| align="left" | Number of lines
 +
|-
 +
| align="left" | SIZE_LINES
 +
| align="left" | uint32
 +
| align="left" | Total size of line data
 +
|-
 +
| align="left" | NPOLYGONS
 +
| align="left" | uint32
 +
| align="left" | Number of polygons
 +
|-
 +
| align="left" | SIZE_POLYGONS
 +
| align="left" | uint32
 +
| align="left" | Total size of polygon data
 +
|-
 +
| align="left" | NTRIANGLE_STRIPS
 +
| align="left" | uint32
 +
| align="left" | Number of triangle strips
 +
|-
 +
| align="left" | SIZE_TRIANGLE_STRIPS
 +
| align="left" | uint32
 +
| align="left" | Total size of triangle strips data
 +
|-
 +
| align="left" | NATTRIBUTES
 +
| align="left" | uint32
 +
| align="left" | Number of dataset attributes
 +
|-
 +
| align="left" | POINTS
 +
| align="left" | float32 * NPOINTS * 3
 +
| align="left" | Coordinates of points (P0x, P0y, P0z, P1x, P1y, P1z, ... P(n-1)x, P(n-1)y, P(n-1)z
 +
|-
 +
| align="left" | VERTICES
 +
| align="left" | uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
 +
| 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, ....))
 +
|-
 +
| align="left" | LINES
 +
| align="left" | uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
 +
| 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, ....))
 +
|-
 +
| align="left" | POLYGONS
 +
| align="left" | uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
 +
| 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, ....))
 +
|-
 +
| align="left" | TRIANGLE_STRIPS
 +
| align="left" | uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1))
 +
| 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, ....))
 +
|-
 +
| align="left" | TYPE_ATTRIBUTE0
 +
| align="left" | uint16
 +
| align="left" | Type of dataset attribute 0 (including number of components for scalar type)
 +
|-
 +
| align="left" | NATTRIBUTE0
 +
| align="left" | uint32
 +
| align="left" | Number of data for attribute 0
 +
|-
 +
| align="left" | TYPE_ATTRIBUTE1
 +
| align="left" | uint16
 +
| align="left" | Type of dataset attribute 1 (including number of components for scalar type)
 +
|-
 +
| align="left" | NATTRIBUTE1
 +
| align="left" | uint32
 +
| align="left" | Number of data for attribute1
 +
|-
 +
| align="left" | ...
 +
| align="left" | ...
 +
| align="left" | ...
 +
|-
 +
| align="left" | TYPE_ATTRIBUTE(NATTRIBUTES-1)
 +
| align="left" | uint16
 +
| align="left" | Type of dataset attribute 1 (including number of components for scalar type)
 +
|-
 +
| align="left" | NATTRIBUTE(NATTRIBUTES-1)
 +
| align="left" | uint32
 +
| align="left" | Number of data for attribute2
 +
|-
 +
| align="left" | NAME_ATTRIBUTE0
 +
| align="left" | char * (name length)
 +
| align="left" | Name of attribute 0
 +
|-
 +
| align="left" | (null)
 +
| align="left" | char
 +
| align="left" | (null)
 +
|-
 +
| align="left" | NAME_ATTRIBUTE1
 +
| align="left" | char * (name length)
 +
| align="left" | Name of attribute 1
 +
|-
 +
| align="left" | (null)
 +
| align="left" | char
 +
| align="left" | (null)
 +
|-
 +
| align="left" | ...
 +
| align="left" | ...
 +
| align="left" | ...
 +
|-
 +
| align="left" | NAME_ATTRIBUTE(NATTRIBUTES-1)
 +
| align="left" | char * (name length)
 +
| align="left" | Name of attribute (NATTRIBUTES-1)
 +
|-
 +
| align="left" | (null)
 +
| align="left" | char
 +
| align="left" | (null)
 
|-
 
|-
 +
| align="left" | (Padding)
 +
| align="left" | char or 0
 +
| align="left" | Padding (inserted if (NAMESIZE_ATTRIBUTE0+1+NAMESIZE_ATTRIBUTE1+1+...NAMESIZE_ATTRIBUTE(NATTRIBUTES-1)+1) % 2 == 1)
 
|-
 
|-
 +
| align="left" | ATTRIBUTE0
 +
| align="left" | SIZE_ATTRIBUTE0 * (number of components) * (float32)
 +
| align="left" | Actual attribute data
 
|-
 
|-
 +
| align="left" | ATTRIBUTE1
 +
| align="left" | NATTRIBUTE0 * (number of components) * (float32)
 +
| align="left" | Actual attribute data
 +
|-
 +
| align="left" | ...
 +
| align="left" | ...
 +
| align="left" | ...
 +
|-
 +
| align="left" | ATTRIBUTE(NATTRIBUTES-1)
 +
| align="left" | NATTRIBUTE(NATTRIBUTES-1) * (number of components) * (float32)
 +
| align="left" | Actual attribute data
 
|-
 
|-
 
|}
 
|}
 +
 +
*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==
 
==GET_POLYDATA==
Line 32: Line 181:
  
 
==STT_POLYDATA==
 
==STT_POLYDATA==
 +
 +
{| 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
 +
|-
 +
|}
 +
 +
<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]]
 +
|-
 +
|}
 +
 +
==STP_POLYDATA==
  
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
Line 41: Line 214:
 
|}
 
|}
  
==STP_POLYDATA==
+
==RTS_POLYDATA==
  
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
Line 48: Line 221:
 
| 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_POLYDATA==
 
  
 
=Implementations=
 
=Implementations=
Line 61: Line 236:
  
 
=Contributors=
 
=Contributors=
Junichi Tokuda, Yuichiro Hayashi
+
Junichi Tokuda
  
 
=Comments=
 
=Comments=

Latest revision as of 04:45, 30 November 2011

Home < OpenIGTLink < ProtocolV2 < Type < PolyData

<< Version 2 Index Page

Summary

POLYDATA is used to transfer 3D polygonal data. The message format is designed based on the POLY DATA format defined in VTK file format and equivalent to VTK's vtkPolyData class. 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

Data Type Description
NPOINTS uint32 Number of points
NVERTICES uint32 Number of vertices
SIZE_VERTICES uint32 Total size of vertices data
NLINES uint32 Number of lines
SIZE_LINES uint32 Total size of line data
NPOLYGONS uint32 Number of polygons
SIZE_POLYGONS uint32 Total size of polygon data
NTRIANGLE_STRIPS uint32 Number of triangle strips
SIZE_TRIANGLE_STRIPS uint32 Total size of triangle strips data
NATTRIBUTES uint32 Number of dataset attributes
POINTS float32 * NPOINTS * 3 Coordinates of points (P0x, P0y, P0z, P1x, P1y, P1z, ... P(n-1)x, P(n-1)y, P(n-1)z
VERTICES uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1)) 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, ....))
LINES uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1)) 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, ....))
POLYGONS uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1)) 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, ....))
TRIANGLE_STRIPS uint32 * ((NPOINTS_0+1) + (NPOINTS_1+1) + (NPOINTS_(N-1)+1)) 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, ....))
TYPE_ATTRIBUTE0 uint16 Type of dataset attribute 0 (including number of components for scalar type)
NATTRIBUTE0 uint32 Number of data for attribute 0
TYPE_ATTRIBUTE1 uint16 Type of dataset attribute 1 (including number of components for scalar type)
NATTRIBUTE1 uint32 Number of data for attribute1
... ... ...
TYPE_ATTRIBUTE(NATTRIBUTES-1) uint16 Type of dataset attribute 1 (including number of components for scalar type)
NATTRIBUTE(NATTRIBUTES-1) uint32 Number of data for attribute2
NAME_ATTRIBUTE0 char * (name length) Name of attribute 0
(null) char (null)
NAME_ATTRIBUTE1 char * (name length) Name of attribute 1
(null) char (null)
... ... ...
NAME_ATTRIBUTE(NATTRIBUTES-1) char * (name length) Name of attribute (NATTRIBUTES-1)
(null) char (null)
(Padding) char or 0 Padding (inserted if (NAMESIZE_ATTRIBUTE0+1+NAMESIZE_ATTRIBUTE1+1+...NAMESIZE_ATTRIBUTE(NATTRIBUTES-1)+1) % 2 == 1)
ATTRIBUTE0 SIZE_ATTRIBUTE0 * (number of components) * (float32) Actual attribute data
ATTRIBUTE1 NATTRIBUTE0 * (number of components) * (float32) Actual attribute data
... ... ...
ATTRIBUTE(NATTRIBUTES-1) NATTRIBUTE(NATTRIBUTES-1) * (number of components) * (float32) Actual attribute data
  • 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

Data Type Description


STT_POLYDATA

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

STP_POLYDATA

Data Type Description

RTS_POLYDATA

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

Implementations

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

Contributors

Junichi Tokuda

Comments