Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlTrajectoryMessage.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: The OpenIGTLink Library
4 Language: C++
5 Web page: http://openigtlink.org/
6
7 Copyright (c) Insight Software Consortium. All rights reserved.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12
13=========================================================================*/
14
15#ifndef __igtlTrajectoryMessage_h
16#define __igtlTrajectoryMessage_h
17
18#include <vector>
19#include <string>
20
21#include "igtlObject.h"
22#include "igtlMath.h"
23#include "igtlMessageBase.h"
24#include "igtlTypes.h"
25
26#include "igtlImageMessage.h"
27
28namespace igtl
29{
30
33{
34public:
39
42
44 enum {
45 TYPE_ENTRY_ONLY = 1, /* Trajectory with only entry point */
46 TYPE_TARGET_ONLY = 2, /* Trajectory with only target point */
47 TYPE_ENTRY_TARGET = 3, /* Trajectory with entry and target point */
48 };
49
50public:
51
53 int SetName(const char* name);
54
56 const char* GetName() { return this->m_Name.c_str(); };
57
59 int SetGroupName(const char* grpname);
60
62 const char* GetGroupName() { return this->m_GroupName.c_str(); };
63
65 int SetType(igtlUint8 type);
67 igtlUint8 GetType() { return this->m_Type; };
68
70 void SetRGBA(igtlUint8 rgba[4]);
71
73 void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
74
76 void GetRGBA(igtlUint8* rgba);
77
79 void GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
80
82 void SetEntryPosition(igtlFloat32 position[3]);
83
85 void SetEntryPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
86
88 void GetEntryPosition(igtlFloat32* position);
89
91 void GetEntryPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
92
94 void SetTargetPosition(igtlFloat32 position[3]);
95
97 void SetTargetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
98
100 void GetTargetPosition(igtlFloat32* position);
101
103 void GetTargetPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
104
106 void SetRadius(igtlFloat32 radius) { this->m_Radius = radius; };
107
109 igtlFloat32 GetRadius() { return this->m_Radius; };
110
112 int SetOwner(const char* owner);
113
115 const char* GetOwner() { return this->m_Owner.c_str(); };
116
117protected:
120
121protected:
122
124 std::string m_Name;
125
127 std::string m_GroupName;
128
130 igtlUint8 m_Type;
131
133 igtlUint8 m_RGBA[4];
134
136 igtlFloat32 m_EntryPosition[3];
137
139 igtlFloat32 m_TargetPosition[3];
140
142 igtlFloat32 m_Radius;
143
145 std::string m_Owner;
146};
147
148
151{
152public:
157
160
161protected:
162 GetTrajectoryMessage() : MessageBase() { this->m_SendMessageType = "GET_TRAJ"; };
164protected:
165 virtual int CalculateContentBufferSize() { return 0; };
166 virtual int PackContent() { AllocateBuffer(); return 1; };
167 virtual int UnpackContent() { return 1; };
168};
169
170
217
218} // namespace igtl
219
220#endif // _igtlTrajectoryMessage_h
A class for the GET_TRAJ message type.
SmartPointer< const Self > ConstPointer
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
igtlTypeMacro(igtl::GetTrajectoryMessage, igtl::MessageBase)
igtlNewMacro(igtl::GetTrajectoryMessage)
Base class for most igtl classes.
Definition igtlObject.h:61
Implements transparent reference counting.
TrajectoryElement class is used to manage a trajectory in TrajectoryMessage class.
const char * GetGroupName()
Gets the group name.
std::string m_GroupName
Can be "Labeled Trajectory", "Landmark", Fiducial", ...
int SetType(igtlUint8 type)
Sets the trajectory type. 'type' must be either TYPE_ENTRY_ONLY, TYPE_TARGET_ONLY,...
void GetEntryPosition(igtlFloat32 *position)
Sets the entry position using an array of x, y, and z coordinates.
void GetRGBA(igtlUint8 &r, igtlUint8 &g, igtlUint8 &b, igtlUint8 &a)
Gets the color of the trajectory.
void GetRGBA(igtlUint8 *rgba)
Gets the color of the trajectory. An array of r, g, b and alpha is stored in 'rgba'.
const char * GetOwner()
Gets the owner of the trajectory.
void SetRadius(igtlFloat32 radius)
Sets the radius.
void SetRGBA(igtlUint8 rgba[4])
Sets the color of the trajectory using an array of r, g, b and alpha.
void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a)
Sets the color of the trajectory by r, g, b and alpha.
std::string m_Owner
Device name of the ower image.
void GetTargetPosition(igtlFloat32 *position)
Gets the target position. Stores an array of x, y, and z coordinates in 'position'.
igtlNewMacro(igtl::TrajectoryElement)
const char * GetName()
Gets the name of the trajectory.
void SetTargetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z)
Sets the target position.
void SetTargetPosition(igtlFloat32 position[3])
Sets the target position using an array of x, y, and z coordinates.
void SetEntryPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z)
Sets the entry position.
void GetEntryPosition(igtlFloat32 &x, igtlFloat32 &y, igtlFloat32 &z)
Gets the entry position.
SmartPointer< const Self > ConstPointer
std::string m_Name
name / description (< 64 bytes)
igtlTypeMacro(igtl::TrajectoryElement, igtl::Object)
int SetName(const char *name)
Sets the name of the trajectory.
void GetTargetPosition(igtlFloat32 &x, igtlFloat32 &y, igtlFloat32 &z)
Gets the target position.
void SetEntryPosition(igtlFloat32 position[3])
Sets the entry position using an array.
igtlFloat32 m_Radius
Radius of the trajectory. Can be 0.
igtlUint8 m_Type
Trajectory type (see TYPE_* constants)
int SetGroupName(const char *grpname)
Sets the group name e.g. "Trajectory".
SmartPointer< Self > Pointer
int SetOwner(const char *owner)
Sets the owner of the trajectory. 'owner' must be a name of image.
igtlUint8 GetType()
Gets the trajectory type. The returned value is either TYPE_ENTRY_ONLY, TYPE_TARGET_ONLY,...
igtlFloat32 GetRadius()
Gets the radius.
int AddTrajectoryElement(TrajectoryElement::Pointer &elem)
Adds a trajectory to the list.
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
igtlTypeMacro(igtl::TrajectoryMessage, igtl::MessageBase)
igtlNewMacro(igtl::TrajectoryMessage)
SmartPointer< const Self > ConstPointer
int GetNumberOfTrajectoryElement()
Gets the number of trajectory in the list.
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
igtlLegacyMacro(void ClearTrajectoryElement(TrajectoryElement::Pointer &elem))
Clears the all trajectory from the list.
void ClearAllTrajectoryElements()
Clears all trajectory elements from the list.
void GetTrajectoryElement(int index, TrajectoryElement::Pointer &elem)
Gets the trajectory specified by 'index'.
std::vector< TrajectoryElement::Pointer > m_TrajectoryList
A list of pointers to the trajectories.
#define IGTLCommon_EXPORT
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...

Generated for OpenIGTLink by Doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2012