00001 /*========================================================================= 00002 00003 Program: Open IGT Link Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/Source/igtlColorTableMessage.h $ 00005 Language: C++ 00006 Date: $Date: 2009-02-03 16:48:16 -0500 (Tue, 03 Feb 2009) $ 00007 Version: $Revision: 3634 $ 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 __igtlColorTableMessage_h 00018 #define __igtlColorTableMessage_h 00019 00020 #include "igtlObject.h" 00021 //#include "igtlMacros.h" 00022 #include "igtlMacro.h" 00023 #include "igtlMath.h" 00024 #include "igtlMessageBase.h" 00025 00026 namespace igtl 00027 { 00028 00029 class IGTLCommon_EXPORT GetColorTableMessage: public MessageBase 00030 { 00031 public: 00032 typedef GetColorTableMessage Self; 00033 typedef MessageBase Superclass; 00034 typedef SmartPointer<Self> Pointer; 00035 typedef SmartPointer<const Self> ConstPointer; 00036 00037 igtlTypeMacro(igtl::GetColorTableMessage, igtl::MessageBase); 00038 igtlNewMacro(igtl::GetColorTableMessage); 00039 00040 protected: 00041 GetColorTableMessage() : MessageBase() { this->m_DefaultBodyType = "GET_COLORT"; }; 00042 ~GetColorTableMessage() {}; 00043 protected: 00044 virtual int GetBodyPackSize() { return 0; }; 00045 virtual int PackBody() { AllocatePack(); return 1; }; 00046 virtual int UnpackBody() { return 1; }; 00047 }; 00048 00049 00050 class IGTLCommon_EXPORT ColorTableMessage: public MessageBase 00051 { 00052 public: 00053 typedef ColorTableMessage Self; 00054 typedef MessageBase Superclass; 00055 typedef SmartPointer<Self> Pointer; 00056 typedef SmartPointer<const Self> ConstPointer; 00057 00058 igtlTypeMacro(igtl::ColorTableMessage, igtl::MessageBase) 00059 igtlNewMacro(igtl::ColorTableMessage); 00060 00061 public: 00062 00063 enum { 00064 INDEX_UINT8 = 3, 00065 INDEX_UINT16 = 5, 00066 MAP_UINT8 = 3, 00067 MAP_UINT16 = 5, 00068 MAP_RGB = 19, 00069 }; 00070 00071 public: 00072 00073 // ColorTable index type 00074 void SetIndexType(int t) { indexType = t; }; 00075 void SetIndexTypeToUint8() { indexType = INDEX_UINT8; }; 00076 void SetIndexTypeToUint16() { indexType = INDEX_UINT16; }; 00077 int GetIndexType() { return indexType; }; 00078 00079 // Map scalar type 00080 void SetMapType(int t) { mapType = t; }; 00081 void SetMapTypeToUint8() { mapType = MAP_UINT8; }; 00082 void SetMapTypeToUint16() { mapType = MAP_UINT16; }; 00083 int GetMapType() { return mapType; }; 00084 00085 // Should returned value be 64-bit integer? 00086 int GetColorTableSize(); 00087 void AllocateTable(); 00088 void* GetTablePointer(); 00089 00090 protected: 00091 ColorTableMessage(); 00092 ~ColorTableMessage(); 00093 00094 protected: 00095 00096 virtual int GetBodyPackSize(); 00097 virtual int PackBody(); 00098 virtual int UnpackBody(); 00099 00100 int indexType; 00101 int mapType; 00102 00103 unsigned char* m_ColorTableHeader; 00104 unsigned char* m_ColorTable; 00105 00106 }; 00107 00108 00109 } // namespace igtl 00110 00111 #endif // _igtlColorTableMessage_h 00112 00113 00114