ITK  4.8.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< typename TLabelImage, typename TOutputImage >
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 
101 
102 protected:
105 
107  void BeforeThreadedGenerateData() ITK_OVERRIDE;
108 
110  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
111 
112  void GenerateOutputInformation() ITK_OVERRIDE;
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
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
void BeforeThreadedGenerateData() override
TLabelImage::PixelType LabelPixelType
void GenerateOutputInformation() override
Functor for converting labels into RGB triplets.
void AddColor(ComponentType r, ComponentType g, ComponentType b)
SmartPointer< const Self > ConstPointer
Implements pixel-wise generic operation on one image.
unsigned int GetNumberOfColors() const
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.
void PrintSelf(std::ostream &os, Indent indent) const override
NumericTraits< OutputPixelType >::ValueType OutputPixelValueType