ITK  5.0.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  BinaryGeneratorImageFilter< TInputImage, TLabelImage, TOutputImage >
58 {
59 public:
60  ITK_DISALLOW_COPY_AND_ASSIGN(LabelOverlayImageFilter);
61 
64 
66 
67  using FunctorType = Functor::LabelOverlayFunctor< typename TInputImage::PixelType,
68  typename TLabelImage::PixelType,
69  typename TOutputImage::PixelType >;
70 
73 
74  using OutputImageType = TOutputImage;
75  using LabelImageType = TLabelImage;
76  using InputImageType = TInputImage;
77 
78  using OutputPixelType = typename TOutputImage::PixelType;
79  using LabelPixelType = typename TLabelImage::PixelType;
80  using InputPixelType = typename TInputImage::PixelType;
81 
84 
86  itkNewMacro(Self);
87 
89  void SetLabelImage(const TLabelImage *input);
90 
92  const LabelImageType * GetLabelImage() const;
93 
97  itkSetMacro(Opacity, double);
98  itkGetConstReferenceMacro(Opacity, double);
100 
102  itkSetMacro(BackgroundValue, LabelPixelType);
103  itkGetConstReferenceMacro(BackgroundValue, LabelPixelType);
105 
106 #ifdef ITK_USE_CONCEPT_CHECKING
107  // Begin concept checking
108  itkConceptMacro( OutputPixelShouldHaveValueType,
110  itkConceptMacro( OutputPixelShouldHaveBracketOperator,
113  unsigned int,
114  typename OutputPixelType::ValueType > ) );
115  // End concept checking
116 #endif
117 
119  void ResetColors();
120 
122  unsigned int GetNumberOfColors() const;
123 
125  using ComponentType = typename OutputPixelType::ComponentType;
126 
128  void AddColor(ComponentType r, ComponentType g, ComponentType b);
129 
130 
131  itkGetConstReferenceMacro(Functor, FunctorType);
132  FunctorType & GetFunctor() { return m_Functor; }
133 
134 protected:
136  ~LabelOverlayImageFilter() override = default;
137 
139  void BeforeThreadedGenerateData() override;
140 
142  void PrintSelf(std::ostream & os, Indent indent) const override;
143 
144  void GenerateOutputInformation() override;
145 
146 private:
147 
149  double m_Opacity;
151 };
152 } // end namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "itkLabelOverlayImageFilter.hxx"
156 #endif
157 
158 #endif
typename OutputPixelType::ComponentType ComponentType
Apply a colormap to a label image and put it on top of the input image.
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 TOutputImage::PixelType OutputPixelType
typename TInputImage::PixelType InputPixelType
Implements pixel-wise generic operation of two images, or of an image and a constant.
typename TLabelImage::PixelType LabelPixelType
TOutputImage OutputImageType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)