ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLabelVotingImageFilter.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 itkLabelVotingImageFilter_h
19 #define itkLabelVotingImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
74 template< typename TInputImage, typename TOutputImage = TInputImage >
75 class ITK_TEMPLATE_EXPORT LabelVotingImageFilter:
76  public ImageToImageFilter< TInputImage, TOutputImage >
77 {
78 public:
79  ITK_DISALLOW_COPY_AND_ASSIGN(LabelVotingImageFilter);
80 
86 
88  itkNewMacro(Self);
89 
92 
95  using OutputPixelType = typename TOutputImage::PixelType;
96  using InputPixelType = typename TInputImage::PixelType;
97 
100  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
101  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
102 
104  using InputImageType = TInputImage;
105  using OutputImageType = TOutputImage;
106  using InputImagePointer = typename InputImageType::ConstPointer;
107  using OutputImagePointer = typename OutputImageType::Pointer;
108 
109  using LabelCountType = unsigned long;
110 
112  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
113 
116  {
117  this->m_LabelForUndecidedPixels = l;
118  this->m_HasLabelForUndecidedPixels = true;
119  this->Modified();
120  }
122 
130  {
131  return this->m_LabelForUndecidedPixels;
132  }
133 
137  {
138  if ( this->m_HasLabelForUndecidedPixels )
139  {
140  this->m_HasLabelForUndecidedPixels = false;
141  this->Modified();
142  }
143  }
145 
146 #ifdef ITK_USE_CONCEPT_CHECKING
147  // Begin concept checking
148  itkConceptMacro( InputConvertibleToOutputCheck,
150  itkConceptMacro( IntConvertibleToInputCheck,
152  itkConceptMacro( SameDimensionCheck,
154  itkConceptMacro( InputUnsignedIntCheck,
156  itkConceptMacro( IntConvertibleToOutputPixelType,
158  itkConceptMacro( InputPlusIntCheck,
160  itkConceptMacro( InputIncrementDecrementOperatorsCheck,
162  itkConceptMacro( OutputOStreamWritableCheck,
164  // End concept checking
165 #endif
166 
167 protected:
169  ~LabelVotingImageFilter() override = default;
170 
173  void BeforeThreadedGenerateData() override;
174 
175  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
176 
177 
178  void PrintSelf(std::ostream &, Indent) const override;
179 
181  InputPixelType ComputeMaximumInputValue();
182 
183 private:
185  bool m_HasLabelForUndecidedPixels{ false };
186  size_t m_TotalLabelCount{ 0 };
187 };
188 } // end namespace itk
189 
190 #ifndef ITK_MANUAL_INSTANTIATION
191 #include "itkLabelVotingImageFilter.hxx"
192 #endif
193 
194 #endif
typename OutputImageType::Pointer OutputImagePointer
This filter performs pixelwise voting among an arbitrary number of input images, where each of them r...
OutputPixelType GetLabelForUndecidedPixels() const
typename TInputImage::PixelType InputPixelType
void SetLabelForUndecidedPixels(const OutputPixelType l)
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 InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename TOutputImage::PixelType OutputPixelType
#define itkConceptMacro(name, concept)