ITK  6.0.0
Insight Toolkit
itkLabelToRGBImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 UnaryFunctorImageFilter<
52  TLabelImage,
53  TOutputImage,
54  Functor::LabelToRGBFunctor<typename TLabelImage::PixelType, typename TOutputImage::PixelType>>
55 {
56 public:
57  ITK_DISALLOW_COPY_AND_MOVE(LabelToRGBImageFilter);
58 
63 
65  TLabelImage,
66  TOutputImage,
68 
69  using OutputImageType = TOutputImage;
70  using LabelImageType = TLabelImage;
71 
72  using OutputPixelType = typename TOutputImage::PixelType;
73  using LabelPixelType = typename TLabelImage::PixelType;
75 
77  itkOverrideGetNameOfClassMacro(LabelToRGBImageFilter);
78 
80  itkNewMacro(Self);
81 
83  itkSetMacro(BackgroundValue, LabelPixelType);
84  itkGetConstReferenceMacro(BackgroundValue, LabelPixelType);
88  itkSetMacro(BackgroundColor, OutputPixelType);
89  itkGetConstReferenceMacro(BackgroundColor, OutputPixelType);
93  void
94  ResetColors();
95 
97  unsigned int
98  GetNumberOfColors() const;
99 
101  using ComponentType = typename OutputPixelType::ComponentType;
102 
104  void
105  AddColor(ComponentType r, ComponentType g, ComponentType b);
106 
107 protected:
109  ~LabelToRGBImageFilter() override = default;
110 
112  void
113  BeforeThreadedGenerateData() override;
114 
116  void
117  PrintSelf(std::ostream & os, Indent indent) const override;
118 
119  void
120  GenerateOutputInformation() override;
121 
122 private:
123  OutputPixelType m_BackgroundColor{};
124  LabelPixelType m_BackgroundValue{};
125 };
126 } // end namespace itk
127 
128 #ifndef ITK_MANUAL_INSTANTIATION
129 # include "itkLabelToRGBImageFilter.hxx"
130 #endif
131 
132 #endif
itkUnaryFunctorImageFilter.h
itk::LabelToRGBImageFilter::ComponentType
typename OutputPixelType::ComponentType ComponentType
Definition: itkLabelToRGBImageFilter.h:101
itk::UnaryFunctorImageFilter
Implements pixel-wise generic operation on one image.
Definition: itkUnaryFunctorImageFilter.h:50
itk::Functor::LabelToRGBFunctor< typename TLabelImage::PixelType, typename TOutputImage::PixelType >
itk::LabelToRGBImageFilter::OutputPixelValueType
typename NumericTraits< OutputPixelType >::ValueType OutputPixelValueType
Definition: itkLabelToRGBImageFilter.h:74
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::LabelToRGBImageFilter::LabelPixelType
typename TLabelImage::PixelType LabelPixelType
Definition: itkLabelToRGBImageFilter.h:73
itkLabelToRGBFunctor.h
itk::LabelToRGBImageFilter::LabelImageType
TLabelImage LabelImageType
Definition: itkLabelToRGBImageFilter.h:70
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::LabelToRGBImageFilter
Apply a colormap to a label image.
Definition: itkLabelToRGBImageFilter.h:50
itk::LabelToRGBImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkLabelToRGBImageFilter.h:72
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90