ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkLabelOverlayImageFilter.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 itkLabelOverlayImageFilter_h
19 #define itkLabelOverlayImageFilter_h
20 
21 #include "itkLabelOverlayFunctor.h"
23 #include "itkConceptChecking.h"
24 
25 namespace itk
26 {
54 template< typename TInputImage, typename TLabelImage, typename TOutputImage >
55 class ITK_TEMPLATE_EXPORT LabelOverlayImageFilter:
56  public
57  BinaryFunctorImageFilter< TInputImage, TLabelImage, TOutputImage,
58  Functor::LabelOverlayFunctor<
59  typename TInputImage::PixelType,
60  typename TLabelImage::PixelType,
61  typename TOutputImage::PixelType > >
62 {
63 public:
66 
67  typedef BinaryFunctorImageFilter< TInputImage, TLabelImage, TOutputImage,
69  typename TInputImage::PixelType,
70  typename TLabelImage::PixelType,
71  typename TOutputImage::PixelType > > Superclass;
72 
75 
76  typedef TOutputImage OutputImageType;
77  typedef TLabelImage LabelImageType;
78  typedef TInputImage InputImageType;
79 
80  typedef typename TOutputImage::PixelType OutputPixelType;
81  typedef typename TLabelImage::PixelType LabelPixelType;
82  typedef typename TInputImage::PixelType InputPixelType;
83 
86 
88  itkNewMacro(Self);
89 
91  void SetLabelImage(const TLabelImage *input);
92 
94  const LabelImageType * GetLabelImage() const;
95 
99  itkSetMacro(Opacity, double);
100  itkGetConstReferenceMacro(Opacity, double);
102 
104  itkSetMacro(BackgroundValue, LabelPixelType);
105  itkGetConstReferenceMacro(BackgroundValue, LabelPixelType);
107 
108 #ifdef ITK_USE_CONCEPT_CHECKING
109  // Begin concept checking
110  itkConceptMacro( OutputPixelShouldHaveValueType,
112  itkConceptMacro( OutputPixelShouldHaveBracketOperator,
115  unsigned int,
116  typename OutputPixelType::ValueType > ) );
117  // End concept checking
118 #endif
119 
121  void ResetColors();
122 
124  unsigned int GetNumberOfColors() const;
125 
127  typedef typename OutputPixelType::ComponentType ComponentType;
128 
130  void AddColor(ComponentType r, ComponentType g, ComponentType b);
131 
132 protected:
134  virtual ~LabelOverlayImageFilter() ITK_OVERRIDE {}
135 
137  void BeforeThreadedGenerateData() ITK_OVERRIDE;
138 
140  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
141 
142  void GenerateOutputInformation() ITK_OVERRIDE;
143 
144 private:
145  ITK_DISALLOW_COPY_AND_ASSIGN(LabelOverlayImageFilter);
146 
147  double m_Opacity;
148  LabelPixelType m_BackgroundValue;
149 };
150 } // end namespace itk
151 
152 #ifndef ITK_MANUAL_INSTANTIATION
153 #include "itkLabelOverlayImageFilter.hxx"
154 #endif
155 
156 #endif
BinaryFunctorImageFilter< TInputImage, TLabelImage, TOutputImage, Functor::LabelOverlayFunctor< typename TInputImage::PixelType, typename TLabelImage::PixelType, typename TOutputImage::PixelType > > Superclass
Apply a colormap to a label image and put it on top of the input image.
OutputPixelType::ComponentType ComponentType
Base class for all process objects that output image data.
Functor for applying a colormap to a label image and combine it with a grayscale image.
SmartPointer< const Self > ConstPointer
TOutputImage::PixelType OutputPixelType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
Implements pixel-wise generic operation of two images, or of an image and a constant.