ITK  4.13.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 {
49 template< typename TLabelImage, typename TOutputImage >
50 class ITK_TEMPLATE_EXPORT LabelToRGBImageFilter:
51  public
52  UnaryFunctorImageFilter< TLabelImage, TOutputImage,
53  Functor::LabelToRGBFunctor<
54  typename TLabelImage::PixelType,
55  typename TOutputImage::PixelType > >
56 {
57 public:
62 
63  typedef UnaryFunctorImageFilter< TLabelImage, TOutputImage,
65  typename TLabelImage::PixelType,
66  typename TOutputImage::PixelType > > Superclass;
67 
68  typedef TOutputImage OutputImageType;
69  typedef TLabelImage LabelImageType;
70 
71  typedef typename TOutputImage::PixelType OutputPixelType;
72  typedef typename TLabelImage::PixelType LabelPixelType;
74 
77 
79  itkNewMacro(Self);
80 
82  itkSetMacro(BackgroundValue, LabelPixelType);
83  itkGetConstReferenceMacro(BackgroundValue, LabelPixelType);
85 
87  itkSetMacro(BackgroundColor, OutputPixelType);
88  itkGetConstReferenceMacro(BackgroundColor, OutputPixelType);
90 
92  void ResetColors();
93 
95  unsigned int GetNumberOfColors() const;
96 
98  typedef typename OutputPixelType::ComponentType ComponentType;
99 
101  void AddColor(ComponentType r, ComponentType g, ComponentType b);
102 
103 protected:
105  virtual ~LabelToRGBImageFilter() ITK_OVERRIDE {}
106 
108  void BeforeThreadedGenerateData() ITK_OVERRIDE;
109 
111  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
112 
113  void GenerateOutputInformation() ITK_OVERRIDE;
114 
115 private:
116  ITK_DISALLOW_COPY_AND_ASSIGN(LabelToRGBImageFilter);
117 
118  OutputPixelType m_BackgroundColor;
119  LabelPixelType m_BackgroundValue;
120 };
121 } // end namespace itk
122 
123 #ifndef ITK_MANUAL_INSTANTIATION
124 #include "itkLabelToRGBImageFilter.hxx"
125 #endif
126 
127 #endif
UnaryFunctorImageFilter< TLabelImage, TOutputImage, Functor::LabelToRGBFunctor< typename TLabelImage::PixelType, typename TOutputImage::PixelType > > Superclass
Base class for all process objects that output image data.
TOutputImage::PixelType OutputPixelType
TLabelImage::PixelType LabelPixelType
Functor for converting labels into RGB triplets.
SmartPointer< const Self > ConstPointer
Implements pixel-wise generic operation on one image.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
OutputPixelType::ComponentType ComponentType
Define additional traits for native types such as int or float.
Apply a colormap to a label image.
NumericTraits< OutputPixelType >::ValueType OutputPixelValueType