00001 #ifndef Impala_Core_Array_Trait_RgbLabelN_h
00002 #define Impala_Core_Array_Trait_RgbLabelN_h
00003
00004 #include "Core/Array/Element/E1Cast.h"
00005
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Array
00011 {
00012 namespace Trait
00013 {
00014
00015
00019 template<class ValT>
00020 class RgbLabelN
00021 {
00022 public:
00024 RgbLabelN()
00025 {
00026 mTab[ 0][0] = 255; mTab[ 0][1] = 0; mTab[ 1][2] = 0;
00027 mTab[ 1][0] = 0; mTab[ 1][1] = 255; mTab[ 1][2] = 0;
00028 mTab[ 2][0] = 0; mTab[ 2][1] = 0; mTab[ 2][2] = 255;
00029 mTab[ 3][0] = 255; mTab[ 3][1] = 255; mTab[ 3][2] = 0;
00030 mTab[ 4][0] = 255; mTab[ 4][1] = 0; mTab[ 4][2] = 255;
00031 mTab[ 5][0] = 0; mTab[ 5][1] = 255; mTab[ 5][2] = 255;
00032 mTab[ 6][0] = 102; mTab[ 6][1] = 51; mTab[ 6][2] = 51;
00033 mTab[ 7][0] = 255; mTab[ 7][1] = 102; mTab[ 7][2] = 0;
00034 mTab[ 8][0] = 255; mTab[ 8][1] = 153; mTab[ 8][2] = 204;
00035 mTab[ 9][0] = 204; mTab[ 9][1] = 255; mTab[ 9][2] = 204;
00036 mTab[10][0] = 204; mTab[10][1] = 153; mTab[10][2] = 51;
00037 mTab[11][0] = 153; mTab[11][1] = 102; mTab[11][2] = 51;
00038 mTab[12][0] = 255; mTab[12][1] = 153; mTab[12][2] = 51;
00039 mTab[13][0] = 51; mTab[13][1] = 204; mTab[13][2] = 102;
00040 mTab[14][0] = 255; mTab[14][1] = 255; mTab[14][2] = 102;
00041 mTab[15][0] = 102; mTab[15][1] = 153; mTab[15][2] = 255;
00042 mTab[16][0] = 0; mTab[16][1] = 102; mTab[16][2] = 51;
00043 mTab[17][0] = 204; mTab[17][1] = 204; mTab[17][2] = 51;
00044 mTab[18][0] = 102; mTab[18][1] = 0; mTab[18][2] = 102;
00045 mTab[19][0] = 153; mTab[19][1] = 153; mTab[19][2] = 255;
00046 mTab[20][0] = 153; mTab[20][1] = 153; mTab[20][2] = 102;
00047 mTab[21][0] = 204; mTab[21][1] = 51; mTab[21][2] = 0;
00048 mTab[22][0] = 153; mTab[22][1] = 0; mTab[22][2] = 204;
00049 mTab[23][0] = 255; mTab[23][1] = 255; mTab[23][2] = 204;
00050 mTab[24][0] = 102; mTab[24][1] = 153; mTab[24][2] = 153;
00051 mTab[25][0] = 255; mTab[25][1] = 204; mTab[25][2] = 153;
00052 mTab[26][0] = 204; mTab[26][1] = 51; mTab[26][2] = 153;
00053 mTab[27][0] = 102; mTab[27][1] = 255; mTab[22][2] = 204;
00054 mTab[28][0] = 204; mTab[28][1] = 102; mTab[28][2] = 51;
00055 mTab[29][0] = 102; mTab[29][1] = 51; mTab[29][2] = 0;
00056 mTab[30][0] = 102; mTab[30][1] = 51; mTab[30][2] = 0;
00057 }
00058
00060 void
00061 DoIt(const ValT& pixV, UInt8* rgbPtr)
00062 {
00063 int pix = Element::E1Cast(pixV, int());
00064 int mask = (pix < 0) ? 30 : pix % 30;
00065 *rgbPtr++ = mTab[mask][0];
00066 *rgbPtr++ = mTab[mask][1];
00067 *rgbPtr++ = mTab[mask][2];
00068 }
00069
00070 private:
00071 int mTab[31][3];
00072 };
00073
00074 }
00075 }
00076 }
00077 }
00078
00079 #endif