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
00049 void useDiscrete(void);
00050 void useGray(int n=256);
00051 void useHeat(int n=256);
00052
00053 itkGetMacro(NumberOfColors, unsigned int);
00054 unsigned int size(void);
00055
00056 RGBPixel<TPixel>* GetColor(unsigned int colorId);
00057 RGBPixel<TPixel>* color(unsigned int c);
00058
00059 bool SetColor(unsigned int c, TPixel r, TPixel g, TPixel b,
00060 const char * name="UserDefined");
00061
00064 TPixel GetColorComponent(unsigned int colorId, char rgb);
00065 TPixel color(unsigned int c, char rgb);
00066 char * GetColorName(unsigned int colorId);
00067 char * colorName(unsigned int c);
00068
00069 unsigned int GetClosestColorTableId(TPixel r, TPixel g, TPixel b);
00070
00071 protected:
00072 ColorTable();
00073 void PrintSelf(std::ostream & os, Indent indent) const;
00074 virtual ~ColorTable();
00075
00076 unsigned int m_NumberOfColors;
00077 RGBPixel<TPixel> * m_Color;
00078 char ** m_ColorName;
00079
00080 private:
00081 ColorTable(const Self&);
00082 void operator=(const Self&);
00083 };
00084
00085
00086 }
00087
00088 #ifndef ITK_MANUAL_INSTANTIATION
00089 #include "itkColorTable.txx"
00090 #endif
00091
00092 #endif