KWStyle - itkColorTable.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkColorTable.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:34 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkColorTable_h
18 #define __itkColorTable_h
19
20 #include <itkObject.h>
21 #include <itkRGBPixel.h>
22 #include <itkObjectFactory.h>
23
24 namespace itk 
25 {
26 /** \class ColorTable
27  *  itkColorTable Class define a Color table for image visualisation
28  * 
29  * \ingroup DataRepresentation
30  */
31
32 template<class TPixel>
33 class ITK_EXPORT ColorTable : public Object
34 {
35 public:
36   /** Standard class typedefs. */
37   typedef ColorTable   Self;
38 TDA   typedef Object Superclass;
39 TDA   typedef SmartPointer<Self>  Pointer;
40 TDA   typedef SmartPointer<const Self>  ConstPointer;
41   
42   /** Method for creation through the object factory. */
43   itkNewMacro(Self);
44
45   /** Run-time type information (and related methods). */
46   itkTypeMacro(ColorTable,Object);
47
48   /** Generate a lookup table of 8 discrete colors. The colors are Red,
49 IND ***** Purple, Aqua, Yellow, Green, Blue, Grey0.70, White.
50 IND *****/
51   void    UseDiscreteColors(void);
52   /** Generate a lookuptable of n grayscale values. A ramp is
53 IND ***** generated from NonpositiveMin() to max() of the pixel type.
54 IND *****/
55   void    UseGrayColors(unsigned int n=256);
56   void    UseHeatColors(unsigned int n=256);
57   void    UseRandomColors(unsigned int n=256);
58
59   /** Badly named methods that require renaming and documentation. */ 
60   void    useDiscrete(void){UseDiscreteColors();};
61   void    useGray(unsigned int n=256){UseGrayColors(n);};
62   void    useHeat(unsigned int n=256){UseHeatColors(n);};
63
64   itkGetMacro(NumberOfColors, unsigned int);
65   unsigned int     size(void);
66
67   RGBPixel<TPixel>*          GetColor(unsigned int colorId);
68   RGBPixel<TPixel>*          color(unsigned int c);
69
70   bool    SetColor(unsigned int c, TPixel r, TPixel g, TPixel b,
71                    const char * name="UserDefined");
72   
73   /** Given the position in the table and the color 
74    * returns the value. \todo Needs renaming. */
75   TPixel  GetColorComponent(unsigned int colorId, char rgb);
76   TPixel  color(unsigned int c, char rgb);
77   char *  GetColorName(unsigned int colorId);
78   char *  colorName(unsigned int c);
79
80   unsigned int GetClosestColorTableId(TPixel r, TPixel g, TPixel b);
81    
82 protected:
83   ColorTable();
84   void PrintSelf(std::ostream & os, Indent indent) const;
85   virtual ~ColorTable();
86
87   unsigned int         m_NumberOfColors;
88   RGBPixel<TPixel> *   m_Color;
89   char **              m_ColorName;
90
91 private:
92   ColorTable(const Self&); //purposely not implemented
93   void operator=(const Self&); //purposely not implemented
94   void DeleteColors();
95 };
96
97
98 }// namespace itk
99
100 #ifndef ITK_MANUAL_INSTANTIATION
101 #include "itkColorTable.txx"
102 #endif
103
104 #endif
105

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:02PM
© Kitware Inc.