Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlLabelMetaMessage.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 __igtlLabelMetaMessage_h
00018 #define __igtlLabelMetaMessage_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 LabelMetaElement: public Object
00035 {
00036 public:
00037   typedef LabelMetaElement               Self;
00038   typedef Object                         Superclass;
00039   typedef SmartPointer<Self>             Pointer;
00040   typedef SmartPointer<const Self>       ConstPointer;
00041 
00042   igtlTypeMacro(igtl::LabelMetaElement, igtl::Object);
00043   igtlNewMacro(igtl::LabelMetaElement);
00044 
00045 public:
00046   int           SetName(const char* name);
00047   const char*   GetName()                            { return this->m_Name.c_str(); };
00048 
00049   int           SetDeviceName(const char* devname);
00050   const char*   GetDeviceName()                      { return this->m_DeviceName.c_str(); };
00051 
00052   void          SetLabel(igtlUint8 label)            { this->m_Label = label; };
00053   igtlUint8     GetLabel()                           { return this->m_Label; };
00054 
00055   void          SetRGBA(igtlUint8 rgba[4]);
00056   void          SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
00057   void          GetRGBA(igtlUint8* rgba);
00058   void          GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
00059   
00060   void          SetSize(igtlUint16 size[3]);
00061   void          SetSize(igtlUint16 sx, igtlUint16 sy, igtlUint16 sz);
00062   void          GetSize(igtlUint16* size);
00063   void          GetSize(igtlUint16& sx, igtlUint16& sy, igtlUint16& sz);
00064   
00065   int           SetOwner(const char* owner);
00066   const char*   GetOwner()                            { return this->m_Owner.c_str(); };
00067 
00068 protected:
00069   LabelMetaElement();
00070   ~LabelMetaElement();
00071 
00072 protected:
00073 
00074   std::string   m_Name;        /* Name / description (< 64 bytes)*/
00075   std::string   m_DeviceName;  /* Device name to query the IMAGE and COLORT */
00076   igtlUint8     m_Label;       /* Label */
00077   igtlUint8     m_RGBA[4];     /* Color in RGBA. default: (0, 0, 0, 0) */
00078   igtlUint16    m_Size[3];     /* entire image volume size */ 
00079   std::string   m_Owner;       /* device name of the owner image. (can be empty) */
00080 
00081 };
00082 
00083 
00084 class IGTLCommon_EXPORT GetLabelMetaMessage: public MessageBase
00085 {
00086 public:
00087   typedef GetLabelMetaMessage            Self;
00088   typedef MessageBase                    Superclass;
00089   typedef SmartPointer<Self>             Pointer;
00090   typedef SmartPointer<const Self>       ConstPointer;
00091 
00092   igtlTypeMacro(igtl::GetLabelMetaMessage, igtl::MessageBase);
00093   igtlNewMacro(igtl::GetLabelMetaMessage);
00094 
00095 protected:
00096   GetLabelMetaMessage() : MessageBase() { this->m_DefaultBodyType  = "GET_LBMETA"; };
00097   ~GetLabelMetaMessage() {};
00098 protected:
00099   virtual int  GetBodyPackSize() { return 0; };
00100   virtual int  PackBody()        { AllocatePack(); return 1; };
00101   virtual int  UnpackBody()      { return 1; };
00102 };
00103 
00104 
00105 class IGTLCommon_EXPORT LabelMetaMessage: public MessageBase
00106 {
00107 public:
00108   typedef LabelMetaMessage               Self;
00109   typedef MessageBase                    Superclass;
00110   typedef SmartPointer<Self>             Pointer;
00111   typedef SmartPointer<const Self>       ConstPointer;
00112 
00113   igtlTypeMacro(igtl::LabelMetaMessage, igtl::MessageBase);
00114   igtlNewMacro(igtl::LabelMetaMessage);
00115 
00116 public:
00117   int  AddLabelMetaElement(LabelMetaElement::Pointer& elem);
00118   void ClearLabelMetaElement();
00119 
00120   int  GetNumberOfLabelMetaElement();
00121   void GetLabelMetaElement(int index, LabelMetaElement::Pointer& elem);
00122 
00123 
00124 protected:
00125   LabelMetaMessage();
00126   ~LabelMetaMessage();
00127   
00128 protected:
00129 
00130   virtual int  GetBodyPackSize();
00131   virtual int  PackBody();
00132   virtual int  UnpackBody();
00133   
00134   std::vector<LabelMetaElement::Pointer> m_LabelMetaList;
00135   
00136 };
00137 
00138 
00139 } // namespace igtl
00140 
00141 #endif // _igtlLabelMetaMessage_h
00142 
00143 
00144 
00145 

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