ITK  6.0.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  * 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 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 
44 template <typename TInputImage, typename TOutputImage = Image<RGBPixel<unsigned char>, TInputImage::ImageDimension>>
45 class ITK_TEMPLATE_EXPORT LabelMapToRGBImageFilter : public LabelMapFilter<TInputImage, TOutputImage>
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_MOVE(LabelMapToRGBImageFilter);
49 
55 
57  using InputImageType = TInputImage;
58  using OutputImageType = TOutputImage;
62  using InputImagePixelType = typename InputImageType::PixelType;
63  using LabelObjectType = typename InputImageType::LabelObjectType;
64 
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  itkOverrideGetNameOfClassMacro(LabelMapToRGBImageFilter);
82 
86  virtual void
87  SetFunctor(const FunctorType & functor)
88  {
89  if (m_Functor != functor)
90  {
91  m_Functor = functor;
92  this->Modified();
93  }
94  }
95  FunctorType &
97  {
98  return m_Functor;
99  }
100  const FunctorType &
101  GetFunctor() const
102  {
103  return m_Functor;
104  }
107 protected:
108  LabelMapToRGBImageFilter() = default;
109  ~LabelMapToRGBImageFilter() override = default;
110 
111  void
112  BeforeThreadedGenerateData() override;
113 
114  void
115  ThreadedProcessLabelObject(LabelObjectType * labelObject) override;
116 
117  void
118  GenerateOutputInformation() override;
119 
120 private:
121  FunctorType m_Functor{};
122 }; // end of class
123 
124 } // end namespace itk
125 
126 #ifndef ITK_MANUAL_INSTANTIATION
127 # include "itkLabelMapToRGBImageFilter.hxx"
128 #endif
129 
130 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::LabelMapFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkLabelMapFilter.h:84
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
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:87
itk::Functor::LabelToRGBFunctor< InputImagePixelType, OutputImagePixelType >
itkImage.h
itk::SmartPointer< Self >
itk::LabelMapFilter::LabelObjectType
typename InputImageType::LabelObjectType LabelObjectType
Definition: itkLabelMapFilter.h:80
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:71
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::LabelMapToRGBImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkLabelMapToRGBImageFilter.h:96
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:57
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LabelMapToRGBImageFilter::GetFunctor
const FunctorType & GetFunctor() const
Definition: itkLabelMapToRGBImageFilter.h:101
FunctorType
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkAddImageFilter.h:97
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
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: itkAnatomicalOrientation.h:29
itk::LabelMapToRGBImageFilter::IndexType
typename OutputImageType::IndexType IndexType
Definition: itkLabelMapToRGBImageFilter.h:69
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
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:45
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90