Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkColorTable.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkColorTable.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/11/04 14:23:44 $
00007   Version:   $Revision: 1.14 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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&); //purposely not implemented
00082   void operator=(const Self&); //purposely not implemented
00083 };
00084 
00085 
00086 }// namespace itk
00087 
00088 #ifndef ITK_MANUAL_INSTANTIATION
00089 #include "itkColorTable.txx"
00090 #endif
00091 
00092 #endif

Generated at Tue Mar 29 23:48:39 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000