Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlPointMessage.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 __igtlPointMessage_h
00018 #define __igtlPointMessage_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 PointElement: public Object
00035 {
00036 public:
00037   typedef PointElement                   Self;
00038   typedef Object                         Superclass;
00039   typedef SmartPointer<Self>             Pointer;
00040   typedef SmartPointer<const Self>       ConstPointer;
00041 
00042   igtlTypeMacro(igtl::PointElement, igtl::Object);
00043   igtlNewMacro(igtl::PointElement);
00044 
00045 public:
00046   int           SetName(const char* name);
00047   const char*   GetName()                            { return this->m_Name.c_str(); };
00048 
00049   int           SetGroupName(const char* grpname);
00050   const char*   GetGroupName()                       { return this->m_GroupName.c_str(); };
00051 
00052   void          SetRGBA(igtlUint8 rgba[4]);
00053   void          SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
00054   void          GetRGBA(igtlUint8* rgba);
00055   void          GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
00056 
00057   void          SetPosition(igtlFloat32 position[3]);
00058   void          SetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
00059   void          GetPosition(igtlFloat32* position);
00060   void          GetPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
00061 
00062   void          SetRadius(igtlFloat32 radius)        { this->m_Radius = radius; };
00063   igtlFloat32   GetRadius()                          { return this->m_Radius; };
00064 
00065   int           SetOwner(const char* owner);
00066   const char*   GetOwner()                           { return this->m_Owner.c_str(); };
00067 
00068 protected:
00069   PointElement();
00070   ~PointElement();
00071 
00072 protected:
00073 
00074   std::string   m_Name;        /* name / description (< 64 bytes)*/
00075   std::string   m_GroupName;   /* Can be "Labeled Point", "Landmark", Fiducial", ... */
00076   igtlUint8     m_RGBA[4];     /* Color in R/G/B/A */
00077   igtlFloat32   m_Position[3]; /* Position */ 
00078   igtlFloat32   m_Radius;      /* Radius of the point. Can be 0. */
00079   std::string   m_Owner;       /* Device name of the ower image */
00080 };
00081 
00082 
00083 class IGTLCommon_EXPORT GetPointMessage: public MessageBase
00084 {
00085 public:
00086   typedef GetPointMessage            Self;
00087   typedef MessageBase                    Superclass;
00088   typedef SmartPointer<Self>             Pointer;
00089   typedef SmartPointer<const Self>       ConstPointer;
00090 
00091   igtlTypeMacro(igtl::GetPointMessage, igtl::MessageBase);
00092   igtlNewMacro(igtl::GetPointMessage);
00093 
00094 protected:
00095   GetPointMessage() : MessageBase() { this->m_DefaultBodyType  = "GET_POINT"; };
00096   ~GetPointMessage() {};
00097 protected:
00098   virtual int  GetBodyPackSize() { return 0; };
00099   virtual int  PackBody()        { AllocatePack(); return 1; };
00100   virtual int  UnpackBody()      { return 1; };
00101 };
00102 
00103 
00104 class IGTLCommon_EXPORT PointMessage: public MessageBase
00105 {
00106 public:
00107   typedef PointMessage               Self;
00108   typedef MessageBase                    Superclass;
00109   typedef SmartPointer<Self>             Pointer;
00110   typedef SmartPointer<const Self>       ConstPointer;
00111 
00112   igtlTypeMacro(igtl::PointMessage, igtl::MessageBase);
00113   igtlNewMacro(igtl::PointMessage);
00114 
00115 public:
00116   int  AddPointElement(PointElement::Pointer& elem);
00117   void ClearPointElement();
00118 
00119   int  GetNumberOfPointElement();
00120   void GetPointElement(int index, PointElement::Pointer& elem);
00121 
00122 
00123 protected:
00124   PointMessage();
00125   ~PointMessage();
00126   
00127 protected:
00128 
00129   virtual int  GetBodyPackSize();
00130   virtual int  PackBody();
00131   virtual int  UnpackBody();
00132   
00133   std::vector<PointElement::Pointer> m_PointList;
00134   
00135 };
00136 
00137 
00138 } // namespace igtl
00139 
00140 #endif // _igtlPointMessage_h
00141 
00142 
00143 
00144 

Generated at Sat Dec 3 2011 08:54:21 for OpenIGTLink by doxygen 1.7.4 written by Dimitri van Heesch, © 1997-2000