ITK  4.13.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:
53 
55  typedef TInputImage InputImageType;
56  typedef TOutputImage OutputImageType;
57  typedef typename InputImageType::Pointer InputImagePointer;
58  typedef typename InputImageType::ConstPointer InputImageConstPointer;
59  typedef typename InputImageType::RegionType InputImageRegionType;
60  typedef typename InputImageType::PixelType InputImagePixelType;
61  typedef typename InputImageType::LabelObjectType LabelObjectType;
62 
63  typedef typename OutputImageType::Pointer OutputImagePointer;
64  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
65  typedef typename OutputImageType::RegionType OutputImageRegionType;
66  typedef typename OutputImageType::PixelType OutputImagePixelType;
68 
70 
72  itkStaticConstMacro(InputImageDimension, unsigned int,
73  TInputImage::ImageDimension);
74  itkStaticConstMacro(OutputImageDimension, unsigned int,
75  TOutputImage::ImageDimension);
77 
79  itkNewMacro(Self);
80 
82  itkTypeMacro(LabelMapToRGBImageFilter,
84 
88  virtual void SetFunctor(const FunctorType & functor)
89  {
90  if ( m_Functor != functor )
91  {
92  m_Functor = functor;
93  this->Modified();
94  }
95  }
96  FunctorType & GetFunctor() { return m_Functor; }
97  const FunctorType & GetFunctor() const { return m_Functor; }
99 
100 protected:
102  ~LabelMapToRGBImageFilter() ITK_OVERRIDE {};
103 
104  virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
105 
106  virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE;
107 
108  virtual void GenerateOutputInformation() ITK_OVERRIDE;
109 
110 private:
111  ITK_DISALLOW_COPY_AND_ASSIGN(LabelMapToRGBImageFilter);
112 
113  FunctorType m_Functor;
114 }; // end of class
115 
116 } // end namespace itk
117 
118 #ifndef ITK_MANUAL_INSTANTIATION
119 #include "itkLabelMapToRGBImageFilter.hxx"
120 #endif
121 
122 #endif
LabelMapFilter< TInputImage, TOutputImage > Superclass
Convert a LabelMap to a colored image.
InputImageType::ConstPointer InputImageConstPointer
OutputImageType::Pointer OutputImagePointer
Functor::LabelToRGBFunctor< InputImagePixelType, OutputImagePixelType > FunctorType
SmartPointer< const Self > ConstPointer
Base class for all process objects that output image data.
OutputImageType::RegionType OutputImageRegionType
InputImageType::LabelObjectType LabelObjectType
OutputImageType::PixelType OutputImagePixelType
OutputImageType::ConstPointer OutputImageConstPointer
InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and overwrite that image as the output...
virtual void SetFunctor(const FunctorType &functor)
const FunctorType & GetFunctor() const
Base class for filters that take an image as input and produce an image as output.
OutputImageType::IndexType IndexType
InputImageType::PixelType InputImagePixelType