ITK  5.1.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  * 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 {
50 template <typename TLabelImage, typename TOutputImage>
51 class ITK_TEMPLATE_EXPORT LabelToRGBImageFilter
52  : public UnaryFunctorImageFilter<
53  TLabelImage,
54  TOutputImage,
55  Functor::LabelToRGBFunctor<typename TLabelImage::PixelType, typename TOutputImage::PixelType>>
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_ASSIGN(LabelToRGBImageFilter);
59 
64 
66  TLabelImage,
67  TOutputImage,
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
95  ResetColors();
96 
98  unsigned int
99  GetNumberOfColors() const;
100 
102  using ComponentType = typename OutputPixelType::ComponentType;
103 
105  void
106  AddColor(ComponentType r, ComponentType g, ComponentType b);
107 
108 protected:
110  ~LabelToRGBImageFilter() override = default;
111 
113  void
114  BeforeThreadedGenerateData() override;
115 
117  void
118  PrintSelf(std::ostream & os, Indent indent) const override;
119 
120  void
121  GenerateOutputInformation() override;
122 
123 private:
126 };
127 } // end namespace itk
128 
129 #ifndef ITK_MANUAL_INSTANTIATION
130 # include "itkLabelToRGBImageFilter.hxx"
131 #endif
132 
133 #endif
itkUnaryFunctorImageFilter.h
itk::LabelToRGBImageFilter::ComponentType
typename OutputPixelType::ComponentType ComponentType
Definition: itkLabelToRGBImageFilter.h:102
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:75
itk::LabelToRGBImageFilter::m_BackgroundValue
LabelPixelType m_BackgroundValue
Definition: itkLabelToRGBImageFilter.h:125
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:58
itk::LabelToRGBImageFilter::LabelPixelType
typename TLabelImage::PixelType LabelPixelType
Definition: itkLabelToRGBImageFilter.h:74
itkLabelToRGBFunctor.h
itk::LabelToRGBImageFilter::LabelImageType
TLabelImage LabelImageType
Definition: itkLabelToRGBImageFilter.h:71
itk::LabelToRGBImageFilter::m_BackgroundColor
OutputPixelType m_BackgroundColor
Definition: itkLabelToRGBImageFilter.h:124
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::LabelToRGBImageFilter
Apply a colormap to a label image.
Definition: itkLabelToRGBImageFilter.h:51
itk::LabelToRGBImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkLabelToRGBImageFilter.h:73
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90