Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __igtlTrajectoryMessage_h
00018 #define __igtlTrajectoryMessage_h
00019
00020 #include <vector>
00021 #include <string>
00022
00023 #include "igtlObject.h"
00024
00025 #include "igtlMath.h"
00026 #include "igtlMessageBase.h"
00027 #include "igtlTypes.h"
00028
00029 #include "igtlImageMessage.h"
00030
00031 namespace igtl
00032 {
00033
00034 class IGTLCommon_EXPORT TrajectoryElement: public Object
00035 {
00036 public:
00037 typedef TrajectoryElement Self;
00038 typedef Object Superclass;
00039 typedef SmartPointer<Self> Pointer;
00040 typedef SmartPointer<const Self> ConstPointer;
00041
00042 igtlTypeMacro(igtl::TrajectoryElement, igtl::Object);
00043 igtlNewMacro(igtl::TrajectoryElement);
00044
00045 enum {
00046 TYPE_ENTRY_ONLY = 1,
00047 TYPE_TARGET_ONLY = 2,
00048 TYPE_ENTRY_TARGET = 3,
00049 };
00050
00051 public:
00052 int SetName(const char* name);
00053 const char* GetName() { return this->m_Name.c_str(); };
00054
00055 int SetGroupName(const char* grpname);
00056 const char* GetGroupName() { return this->m_GroupName.c_str(); };
00057
00058 int SetType(igtlUint8 type);
00059 igtlUint8 GetType() { return this->m_Type; };
00060
00061 void SetRGBA(igtlUint8 rgba[4]);
00062 void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
00063 void GetRGBA(igtlUint8* rgba);
00064 void GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
00065
00066 void SetEntryPosition(igtlFloat32 position[3]);
00067 void SetEntryPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
00068 void GetEntryPosition(igtlFloat32* position);
00069 void GetEntryPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
00070
00071 void SetTargetPosition(igtlFloat32 position[3]);
00072 void SetTargetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
00073 void GetTargetPosition(igtlFloat32* position);
00074 void GetTargetPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
00075
00076 void SetRadius(igtlFloat32 radius) { this->m_Radius = radius; };
00077 igtlFloat32 GetRadius() { return this->m_Radius; };
00078
00079 int SetOwner(const char* owner);
00080 const char* GetOwner() { return this->m_Owner.c_str(); };
00081
00082 protected:
00083 TrajectoryElement();
00084 ~TrajectoryElement();
00085
00086 protected:
00087
00088 std::string m_Name;
00089 std::string m_GroupName;
00090 igtlUint8 m_Type;
00091 igtlUint8 m_RGBA[4];
00092 igtlFloat32 m_EntryPosition[3];
00093 igtlFloat32 m_TargetPosition[3];
00094 igtlFloat32 m_Radius;
00095 std::string m_Owner;
00096 };
00097
00098
00099 class IGTLCommon_EXPORT GetTrajectoryMessage: public MessageBase
00100 {
00101 public:
00102 typedef GetTrajectoryMessage Self;
00103 typedef MessageBase Superclass;
00104 typedef SmartPointer<Self> Pointer;
00105 typedef SmartPointer<const Self> ConstPointer;
00106
00107 igtlTypeMacro(igtl::GetTrajectoryMessage, igtl::MessageBase);
00108 igtlNewMacro(igtl::GetTrajectoryMessage);
00109
00110 protected:
00111 GetTrajectoryMessage() : MessageBase() { this->m_DefaultBodyType = "GET_TRAJ"; };
00112 ~GetTrajectoryMessage() {};
00113 protected:
00114 virtual int GetBodyPackSize() { return 0; };
00115 virtual int PackBody() { AllocatePack(); return 1; };
00116 virtual int UnpackBody() { return 1; };
00117 };
00118
00119
00120 class IGTLCommon_EXPORT TrajectoryMessage: public MessageBase
00121 {
00122 public:
00123 typedef TrajectoryMessage Self;
00124 typedef MessageBase Superclass;
00125 typedef SmartPointer<Self> Pointer;
00126 typedef SmartPointer<const Self> ConstPointer;
00127
00128 igtlTypeMacro(igtl::TrajectoryMessage, igtl::MessageBase);
00129 igtlNewMacro(igtl::TrajectoryMessage);
00130
00131 public:
00132 int AddTrajectoryElement(TrajectoryElement::Pointer& elem);
00133 void ClearTrajectoryElement(TrajectoryElement::Pointer& elem);
00134
00135 int GetNumberOfTrajectoryElement();
00136 void GetTrajectoryElement(int index, TrajectoryElement::Pointer& elem);
00137
00138
00139 protected:
00140 TrajectoryMessage();
00141 ~TrajectoryMessage();
00142
00143 protected:
00144
00145 virtual int GetBodyPackSize();
00146 virtual int PackBody();
00147 virtual int UnpackBody();
00148
00149 std::vector<TrajectoryElement::Pointer> m_TrajectoryList;
00150
00151 };
00152
00153
00154 }
00155
00156 #endif // _igtlTrajectoryMessage_h
00157
00158
00159
00160