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: 2005/06/09 11:12:48 $
00007   Version:   $Revision: 1.16 $
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 
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&); //purposely not implemented
00093   void operator=(const Self&); //purposely not implemented
00094   void DeleteColors();
00095 };
00096 
00097 
00098 }// namespace itk
00099 
00100 #ifndef ITK_MANUAL_INSTANTIATION
00101 #include "itkColorTable.txx"
00102 #endif
00103 
00104 #endif

Generated at Wed May 24 22:57:17 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000