ITK  6.0.0
Insight Toolkit
itkLabelVotingImageFilter.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 itkLabelVotingImageFilter_h
19 #define itkLabelVotingImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
75 template <typename TInputImage, typename TOutputImage = TInputImage>
76 class ITK_TEMPLATE_EXPORT LabelVotingImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
77 {
78 public:
79  ITK_DISALLOW_COPY_AND_MOVE(LabelVotingImageFilter);
80 
86 
88  itkNewMacro(Self);
89 
91  itkOverrideGetNameOfClassMacro(LabelVotingImageFilter);
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;
108 
109  using LabelCountType = unsigned long;
110 
112  using typename Superclass::OutputImageRegionType;
113 
115  void
117  {
118  this->m_LabelForUndecidedPixels = l;
119  this->m_HasLabelForUndecidedPixels = true;
120  this->Modified();
121  }
130  OutputPixelType
132  {
133  return this->m_LabelForUndecidedPixels;
134  }
135 
138  void
140  {
141  if (this->m_HasLabelForUndecidedPixels)
142  {
143  this->m_HasLabelForUndecidedPixels = false;
144  this->Modified();
145  }
146  }
149 #ifdef ITK_USE_CONCEPT_CHECKING
150  // Begin concept checking
152  itkConceptMacro(IntConvertibleToInputCheck, (Concept::Convertible<int, InputPixelType>));
155  itkConceptMacro(IntConvertibleToOutputPixelType, (Concept::Convertible<int, OutputPixelType>));
157  itkConceptMacro(InputIncrementDecrementOperatorsCheck, (Concept::IncrementDecrementOperators<InputPixelType>));
158  itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
159  // End concept checking
160 #endif
161 
162 protected:
164  ~LabelVotingImageFilter() override = default;
165 
168  void
169  BeforeThreadedGenerateData() override;
170 
171  void
172  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
173 
174 
175  void
176  PrintSelf(std::ostream &, Indent) const override;
177 
179  InputPixelType
180  ComputeMaximumInputValue();
181 
182 private:
183  OutputPixelType m_LabelForUndecidedPixels{};
184  bool m_HasLabelForUndecidedPixels{ false };
185  size_t m_TotalLabelCount{ 0 };
186 };
187 } // end namespace itk
188 
189 #ifndef ITK_MANUAL_INSTANTIATION
190 # include "itkLabelVotingImageFilter.hxx"
191 #endif
192 
193 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:639
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::LabelVotingImageFilter
This filter performs pixelwise voting among an arbitrary number of input images, where each of them r...
Definition: itkLabelVotingImageFilter.h:76
itk::LabelVotingImageFilter::SetLabelForUndecidedPixels
void SetLabelForUndecidedPixels(const OutputPixelType l)
Definition: itkLabelVotingImageFilter.h:116
itk::LabelVotingImageFilter::LabelCountType
unsigned long LabelCountType
Definition: itkLabelVotingImageFilter.h:109
itk::LabelVotingImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkLabelVotingImageFilter.h:96
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Concept::SameDimension
Definition: itkConceptChecking.h:697
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::Concept::IsUnsignedInteger
Definition: itkConceptChecking.h:906
itk::Concept::AdditiveOperators
Definition: itkConceptChecking.h:361
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::Concept::Convertible
Definition: itkConceptChecking.h:217
itk::Concept::IncrementDecrementOperators
Definition: itkConceptChecking.h:618
itk::LabelVotingImageFilter::GetLabelForUndecidedPixels
OutputPixelType GetLabelForUndecidedPixels() const
Definition: itkLabelVotingImageFilter.h:131
itk::LabelVotingImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkLabelVotingImageFilter.h:95
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::LabelVotingImageFilter::UnsetLabelForUndecidedPixels
void UnsetLabelForUndecidedPixels()
Definition: itkLabelVotingImageFilter.h:139