ITK  5.0.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:
58  ITK_DISALLOW_COPY_AND_ASSIGN(LabelToRGBImageFilter);
59 
64 
65  using Superclass = UnaryFunctorImageFilter< TLabelImage, TOutputImage,
67  typename TLabelImage::PixelType,
68  typename TOutputImage::PixelType > >;
69 
70  using OutputImageType = TOutputImage;
71  using LabelImageType = TLabelImage;
72 
73  using OutputPixelType = typename TOutputImage::PixelType;
74  using LabelPixelType = typename TLabelImage::PixelType;
76 
79 
81  itkNewMacro(Self);
82 
84  itkSetMacro(BackgroundValue, LabelPixelType);
85  itkGetConstReferenceMacro(BackgroundValue, LabelPixelType);
87 
89  itkSetMacro(BackgroundColor, OutputPixelType);
90  itkGetConstReferenceMacro(BackgroundColor, OutputPixelType);
92 
94  void ResetColors();
95 
97  unsigned int GetNumberOfColors() const;
98 
100  using ComponentType = typename OutputPixelType::ComponentType;
101 
103  void AddColor(ComponentType r, ComponentType g, ComponentType b);
104 
105 protected:
107  ~LabelToRGBImageFilter() override = default;
108 
110  void BeforeThreadedGenerateData() override;
111 
113  void PrintSelf(std::ostream & os, Indent indent) const override;
114 
115  void GenerateOutputInformation() override;
116 
117 private:
120 };
121 } // end namespace itk
122 
123 #ifndef ITK_MANUAL_INSTANTIATION
124 #include "itkLabelToRGBImageFilter.hxx"
125 #endif
126 
127 #endif
Define numeric traits for std::vector.
typename TOutputImage::PixelType OutputPixelType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputPixelType::ComponentType ComponentType
typename TLabelImage::PixelType LabelPixelType
TOutputImage OutputImageType
Functor for converting labels into RGB triplets.
typename NumericTraits< OutputPixelType >::ValueType OutputPixelValueType
Implements pixel-wise generic operation on one image.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Apply a colormap to a label image.