ITK  5.1.0
Insight Toolkit
itkLabelMapToRGBImageFilter.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 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 {
29 
45 template <typename TInputImage, typename TOutputImage = Image<RGBPixel<unsigned char>, TInputImage::ImageDimension>>
46 class ITK_TEMPLATE_EXPORT LabelMapToRGBImageFilter : public LabelMapFilter<TInputImage, TOutputImage>
47 {
48 public:
49  ITK_DISALLOW_COPY_AND_ASSIGN(LabelMapToRGBImageFilter);
50 
56 
58  using InputImageType = TInputImage;
59  using OutputImageType = TOutputImage;
60  using InputImagePointer = typename InputImageType::Pointer;
61  using InputImageConstPointer = typename InputImageType::ConstPointer;
63  using InputImagePixelType = typename InputImageType::PixelType;
64  using LabelObjectType = typename InputImageType::LabelObjectType;
65 
66  using OutputImagePointer = typename OutputImageType::Pointer;
67  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
69  using OutputImagePixelType = typename OutputImageType::PixelType;
71 
73 
75  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
76  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
77 
79  itkNewMacro(Self);
80 
83 
87  virtual void
88  SetFunctor(const FunctorType & functor)
89  {
90  if (m_Functor != functor)
91  {
92  m_Functor = functor;
93  this->Modified();
94  }
95  }
96  FunctorType &
98  {
99  return m_Functor;
100  }
101  const FunctorType &
102  GetFunctor() const
103  {
104  return m_Functor;
105  }
107 
108 protected:
109  LabelMapToRGBImageFilter() = default;
110  ~LabelMapToRGBImageFilter() override = default;
111 
112  void
113  BeforeThreadedGenerateData() override;
114 
115  void
116  ThreadedProcessLabelObject(LabelObjectType * labelObject) override;
117 
118  void
119  GenerateOutputInformation() override;
120 
121 private:
123 }; // end of class
124 
125 } // end namespace itk
126 
127 #ifndef ITK_MANUAL_INSTANTIATION
128 # include "itkLabelMapToRGBImageFilter.hxx"
129 #endif
130 
131 #endif
itk::LabelMapFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkLabelMapFilter.h:85
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itkRGBPixel.h
itk::LabelMapToRGBImageFilter::SetFunctor
virtual void SetFunctor(const FunctorType &functor)
Definition: itkLabelMapToRGBImageFilter.h:88
itk::Functor::LabelToRGBFunctor< InputImagePixelType, OutputImagePixelType >
itkImage.h
itk::SmartPointer< Self >
itk::LabelMapFilter::LabelObjectType
typename InputImageType::LabelObjectType LabelObjectType
Definition: itkLabelMapFilter.h:81
itkLabelMapFilter.h
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::LabelMapToRGBImageFilter::FunctorType
typename Functor::LabelToRGBFunctor< InputImagePixelType, OutputImagePixelType > FunctorType
Definition: itkLabelMapToRGBImageFilter.h:72
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::LabelMapToRGBImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkLabelMapToRGBImageFilter.h:97
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::LabelMapFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkLabelMapFilter.h:58
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LabelMapToRGBImageFilter::GetFunctor
const FunctorType & GetFunctor() const
Definition: itkLabelMapToRGBImageFilter.h:102
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::LabelMapToRGBImageFilter::m_Functor
FunctorType m_Functor
Definition: itkLabelMapToRGBImageFilter.h:122
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkLabelToRGBFunctor.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::LabelMapToRGBImageFilter::IndexType
typename OutputImageType::IndexType IndexType
Definition: itkLabelMapToRGBImageFilter.h:70
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::LabelMapToRGBImageFilter
Convert a LabelMap to a colored image.
Definition: itkLabelMapToRGBImageFilter.h:46
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90