ITK  6.0.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  * 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 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 
83  itkOverrideGetNameOfClassMacro(LabelOverlayImageFilter);
84 
86  itkNewMacro(Self);
87 
89  void
90  SetLabelImage(const TLabelImage * input);
91  const LabelImageType *
92  GetLabelImage() const;
98  itkSetMacro(Opacity, double);
99  itkGetConstReferenceMacro(Opacity, double);
103  itkSetMacro(BackgroundValue, LabelPixelType);
104  itkGetConstReferenceMacro(BackgroundValue, LabelPixelType);
107 #ifdef ITK_USE_CONCEPT_CHECKING
108  // Begin concept checking
109  itkConceptMacro(OutputPixelShouldHaveValueType, (Concept::HasValueType<OutputPixelType>));
110  itkConceptMacro(OutputPixelShouldHaveBracketOperator,
112  // End concept checking
113 #endif
114 
116  void
117  ResetColors();
118 
120  unsigned int
121  GetNumberOfColors() const;
122 
124  using ComponentType = typename OutputPixelType::ComponentType;
125 
127  void
128  AddColor(ComponentType r, ComponentType g, ComponentType b);
129 
130 
131  itkGetConstReferenceMacro(Functor, FunctorType);
132  FunctorType &
134  {
135  return m_Functor;
136  }
137 
138 protected:
140  ~LabelOverlayImageFilter() override = default;
141 
143  void
144  BeforeThreadedGenerateData() override;
145 
147  void
148  PrintSelf(std::ostream & os, Indent indent) const override;
149 
150  void
151  GenerateOutputInformation() override;
152 
153 private:
154  FunctorType m_Functor{};
155  double m_Opacity{};
156  LabelPixelType m_BackgroundValue{};
157 };
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 # include "itkLabelOverlayImageFilter.hxx"
162 #endif
163 
164 #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:772
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:124
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::LabelOverlayImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkLabelOverlayImageFilter.h:133
itk::LabelOverlayImageFilter::LabelPixelType
typename TLabelImage::PixelType LabelPixelType
Definition: itkLabelOverlayImageFilter.h:79
itk::Concept::BracketOperator
Definition: itkConceptChecking.h:571
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::LabelOverlayImageFilter::LabelImageType
TLabelImage LabelImageType
Definition: itkLabelOverlayImageFilter.h:75