ITK  5.2.0
Insight Toolkit
itkLabelOverlayImageFilter.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 itkLabelOverlayImageFilter_h
19 #define itkLabelOverlayImageFilter_h
20 
21 #include "itkLabelOverlayFunctor.h"
23 #include "itkConceptChecking.h"
24 
25 namespace itk
26 {
55 template <typename TInputImage, typename TLabelImage, typename TOutputImage>
56 class ITK_TEMPLATE_EXPORT LabelOverlayImageFilter
57  : public BinaryGeneratorImageFilter<TInputImage, TLabelImage, TOutputImage>
58 {
59 public:
60  ITK_DISALLOW_COPY_AND_MOVE(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
90  SetLabelImage(const TLabelImage * input);
91 
93  const LabelImageType *
94  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, (Concept::HasValueType<OutputPixelType>));
111  itkConceptMacro(OutputPixelShouldHaveBracketOperator,
113  // End concept checking
114 #endif
115 
117  void
118  ResetColors();
119 
121  unsigned int
122  GetNumberOfColors() const;
123 
125  using ComponentType = typename OutputPixelType::ComponentType;
126 
128  void
129  AddColor(ComponentType r, ComponentType g, ComponentType b);
130 
131 
132  itkGetConstReferenceMacro(Functor, FunctorType);
133  FunctorType &
135  {
136  return m_Functor;
137  }
138 
139 protected:
141  ~LabelOverlayImageFilter() override = default;
142 
144  void
145  BeforeThreadedGenerateData() override;
146 
148  void
149  PrintSelf(std::ostream & os, Indent indent) const override;
150 
151  void
152  GenerateOutputInformation() override;
153 
154 private:
156  double m_Opacity;
158 };
159 } // end namespace itk
160 
161 #ifndef ITK_MANUAL_INSTANTIATION
162 # include "itkLabelOverlayImageFilter.hxx"
163 #endif
164 
165 #endif
itk::LabelOverlayImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkLabelOverlayImageFilter.h:80
itk::LabelOverlayImageFilter
Apply a colormap to a label image and put it on top of the input image.
Definition: itkLabelOverlayImageFilter.h:56
itk::Functor::LabelOverlayFunctor< typename TInputImage::PixelType, typename TLabelImage::PixelType, typename TOutputImage::PixelType >
itk::LabelOverlayImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkLabelOverlayImageFilter.h:78
itk::Concept::HasValueType
Definition: itkConceptChecking.h:770
itkLabelOverlayFunctor.h
itkConceptChecking.h
itk::BinaryGeneratorImageFilter
Implements pixel-wise generic operation of two images, or of an image and a constant.
Definition: itkBinaryGeneratorImageFilter.h:56
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkBinaryGeneratorImageFilter.h
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::LabelOverlayImageFilter::ComponentType
typename OutputPixelType::ComponentType ComponentType
Definition: itkLabelOverlayImageFilter.h:125
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::LabelOverlayImageFilter::m_Functor
FunctorType m_Functor
Definition: itkLabelOverlayImageFilter.h:155
itk::LabelOverlayImageFilter::m_Opacity
double m_Opacity
Definition: itkLabelOverlayImageFilter.h:156
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::LabelOverlayImageFilter::m_BackgroundValue
LabelPixelType m_BackgroundValue
Definition: itkLabelOverlayImageFilter.h:157
itk::LabelOverlayImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkLabelOverlayImageFilter.h:134
itk::LabelOverlayImageFilter::LabelPixelType
typename TLabelImage::PixelType LabelPixelType
Definition: itkLabelOverlayImageFilter.h:79
itk::Concept::BracketOperator
Definition: itkConceptChecking.h:569
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::LabelOverlayImageFilter::LabelImageType
TLabelImage LabelImageType
Definition: itkLabelOverlayImageFilter.h:75