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.
00001 /*=========================================================================
00002 
00003   Program:   Open IGT Link Library
00004   Module:    $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/Source/igtlImgmetaMessage.h $
00005   Language:  C++
00006   Date:      $Date: 2009-12-16 23:58:02 -0500 (Wed, 16 Dec 2009) $
00007   Version:   $Revision: 5466 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010 
00011   This software is distributed WITHOUT ANY WARRANTY; without even
00012   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013   PURPOSE.  See the above copyright notices for more information.
00014 
00015 =========================================================================*/
00016 
00017 #ifndef __igtlTrajectoryMessage_h
00018 #define __igtlTrajectoryMessage_h
00019 
00020 #include <vector>
00021 #include <string>
00022 
00023 #include "igtlObject.h"
00024 //#include "igtlMacros.h"
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;        /* name / description (< 64 bytes)*/
00089   std::string   m_GroupName;   /* Can be "Labeled Trajectory", "Landmark", Fiducial", ... */
00090   igtlUint8     m_Type;        /* Trajectory type (see TYPE_* constants) */
00091   igtlUint8     m_RGBA[4];     /* Color in R/G/B/A */
00092   igtlFloat32   m_EntryPosition[3];  /* Coordinate of the entry point */
00093   igtlFloat32   m_TargetPosition[3]; /* Coordinate of the target point */
00094   igtlFloat32   m_Radius;      /* Radius of the trajectory. Can be 0. */
00095   std::string   m_Owner;       /* Device name of the ower image */
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 } // namespace igtl
00155 
00156 #endif // _igtlTrajectoryMessage_h
00157 
00158 
00159 
00160 

Generated at Wed Apr 27 2011 00:08:07 for OpenIGTLink by doxygen 1.7.4 written by Dimitri van Heesch, © 1997-2000