ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLabelMapToRGBImageFilter.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 itkLabelMapToRGBImageFilter_h
19 #define itkLabelMapToRGBImageFilter_h
20 
21 #include "itkLabelMapFilter.h"
22 #include "itkLabelToRGBFunctor.h"
23 #include "itkImage.h"
24 #include "itkRGBPixel.h"
25 
26 
27 namespace itk {
28 
43 template<typename TInputImage, typename TOutputImage=Image< RGBPixel<unsigned char>, TInputImage::ImageDimension > >
44 class ITK_TEMPLATE_EXPORT LabelMapToRGBImageFilter :
45  public LabelMapFilter<TInputImage, TOutputImage>
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_ASSIGN(LabelMapToRGBImageFilter);
49 
55 
57  using InputImageType = TInputImage;
58  using OutputImageType = TOutputImage;
59  using InputImagePointer = typename InputImageType::Pointer;
60  using InputImageConstPointer = typename InputImageType::ConstPointer;
62  using InputImagePixelType = typename InputImageType::PixelType;
63  using LabelObjectType = typename InputImageType::LabelObjectType;
64 
65  using OutputImagePointer = typename OutputImageType::Pointer;
66  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
68  using OutputImagePixelType = typename OutputImageType::PixelType;
70 
72 
74  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
75  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
76 
78  itkNewMacro(Self);
79 
81  itkTypeMacro(LabelMapToRGBImageFilter,
83 
87  virtual void SetFunctor(const FunctorType & functor)
88  {
89  if ( m_Functor != functor )
90  {
91  m_Functor = functor;
92  this->Modified();
93  }
94  }
95  FunctorType & GetFunctor() { return m_Functor; }
96  const FunctorType & GetFunctor() const { return m_Functor; }
98 
99 protected:
100  LabelMapToRGBImageFilter() = default;
101  ~LabelMapToRGBImageFilter() override = default;
102 
103  void BeforeThreadedGenerateData() override;
104 
105  void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override;
106 
107  void GenerateOutputInformation() override;
108 
109 private:
111 }; // end of class
112 
113 } // end namespace itk
114 
115 #ifndef ITK_MANUAL_INSTANTIATION
116 #include "itkLabelMapToRGBImageFilter.hxx"
117 #endif
118 
119 #endif
typename OutputImageType::Pointer OutputImagePointer
Convert a LabelMap to a colored image.
typename InputImageType::LabelObjectType LabelObjectType
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 Functor::LabelToRGBFunctor< InputImagePixelType, OutputImagePixelType > FunctorType
typename OutputImageType::ConstPointer OutputImageConstPointer
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Base class for filters that take an image as input and overwrite that image as the output...
virtual void SetFunctor(const FunctorType &functor)
typename OutputImageType::IndexType IndexType
typename InputImageType::RegionType InputImageRegionType
const FunctorType & GetFunctor() const
Base class for filters that take an image as input and produce an image as output.
typename InputImageType::ConstPointer InputImageConstPointer