00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkColorTable_h
00018 #define __itkColorTable_h
00019
00020 #include <itkObject.h>
00021 #include <itkRGBPixel.h>
00022 #include <itkObjectFactory.h>
00023
00024 namespace itk
00025 {
00032 template<class TPixel>
00033 class ITK_EXPORT ColorTable : public Object
00034 {
00035 public:
00037 typedef ColorTable Self;
00038 typedef Object Superclass;
00039 typedef SmartPointer<Self> Pointer;
00040 typedef SmartPointer<const Self> ConstPointer;
00041
00043 itkNewMacro(Self);
00044
00046 itkTypeMacro(ColorTable,Object);
00047
00051 void UseDiscreteColors(void);
00055 void UseGrayColors(unsigned int n=256);
00056 void UseHeatColors(unsigned int n=256);
00057 void UseRandomColors(unsigned int n=256);
00058
00060 void useDiscrete(void){UseDiscreteColors();};
00061 void useGray(unsigned int n=256){UseGrayColors(n);};
00062 void useHeat(unsigned int n=256){UseHeatColors(n);};
00063
00064 itkGetMacro(NumberOfColors, unsigned int);
00065 unsigned int size(void);
00066
00067 RGBPixel<TPixel>* GetColor(unsigned int colorId);
00068 RGBPixel<TPixel>* color(unsigned int c);
00069
00070 bool SetColor(unsigned int c, TPixel r, TPixel g, TPixel b,
00071 const char * name="UserDefined");
00072
00075 TPixel GetColorComponent(unsigned int colorId, char rgb);
00076 TPixel color(unsigned int c, char rgb);
00077 char * GetColorName(unsigned int colorId);
00078 char * colorName(unsigned int c);
00079
00080 unsigned int GetClosestColorTableId(TPixel r, TPixel g, TPixel b);
00081
00082 protected:
00083 ColorTable();
00084 void PrintSelf(std::ostream & os, Indent indent) const;
00085 virtual ~ColorTable();
00086
00087 unsigned int m_NumberOfColors;
00088 RGBPixel<TPixel> * m_Color;
00089 char ** m_ColorName;
00090
00091 private:
00092 ColorTable(const Self&);
00093 void operator=(const Self&);
00094 void DeleteColors();
00095 };
00096
00097
00098 }
00099
00100 #ifndef ITK_MANUAL_INSTANTIATION
00101 #include "itkColorTable.txx"
00102 #endif
00103
00104 #endif