ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkLabelToRGBImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkLabelToRGBImageFilter_h
19 #define __itkLabelToRGBImageFilter_h
20 
22 #include "itkLabelToRGBFunctor.h"
23 
24 namespace itk
25 {
48 template< class TLabelImage, typename TOutputImage >
49 class ITK_EXPORT LabelToRGBImageFilter:
50  public
51  UnaryFunctorImageFilter< TLabelImage, TOutputImage,
52  Functor::LabelToRGBFunctor<
53  typename TLabelImage::PixelType,
54  typename TOutputImage::PixelType > >
55 {
56 public:
61 
62  typedef UnaryFunctorImageFilter< TLabelImage, TOutputImage,
64  typename TLabelImage::PixelType,
65  typename TOutputImage::PixelType > > Superclass;
66 
67  typedef TOutputImage OutputImageType;
68  typedef TLabelImage LabelImageType;
69 
70  typedef typename TOutputImage::PixelType OutputPixelType;
71  typedef typename TLabelImage::PixelType LabelPixelType;
73 
76 
78  itkNewMacro(Self);
79 
81  itkSetMacro(BackgroundValue, LabelPixelType);
82  itkGetConstReferenceMacro(BackgroundValue, LabelPixelType);
84 
86  itkSetMacro(BackgroundColor, OutputPixelType);
87  itkGetConstReferenceMacro(BackgroundColor, OutputPixelType);
89 
91  void ResetColors();
92 
94  unsigned int GetNumberOfColors() const;
95 
97  typedef typename OutputPixelType::ComponentType ComponentType;
98 
100  void AddColor(ComponentType r, ComponentType g, ComponentType b);
101 
102 protected:
105 
107  void BeforeThreadedGenerateData(void);
108 
110  void PrintSelf(std::ostream & os, Indent indent) const;
111 
112  void GenerateOutputInformation();
113 
114 private:
115  LabelToRGBImageFilter(const Self &); //purposely not implemented
116  void operator=(const Self &); //purposely not implemented
117 
120 };
121 } // end namespace itk
122 
123 #ifndef ITK_MANUAL_INSTANTIATION
124 #include "itkLabelToRGBImageFilter.hxx"
125 #endif
126 
127 #endif
128