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
22
23namespace itk
24{
75template <typename TInputImage, typename TOutputImage = TInputImage>
76class ITK_TEMPLATE_EXPORT LabelVotingImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
77{
78public:
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
162protected:
164 ~LabelVotingImageFilter() override = default;
165
168 void
170
171 void
172 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
173
174
175 void
176 PrintSelf(std::ostream &, Indent) const override;
177
181
182private:
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
typename OutputImageType::RegionType OutputImageRegionType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
This filter performs pixelwise voting among an arbitrary number of input images, where each of them r...
typename TOutputImage::PixelType OutputPixelType
void BeforeThreadedGenerateData() override
~LabelVotingImageFilter() override=default
void PrintSelf(std::ostream &, Indent) const override
typename TInputImage::PixelType InputPixelType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void SetLabelForUndecidedPixels(const OutputPixelType l)
typename OutputImageType::Pointer OutputImagePointer
OutputPixelType GetLabelForUndecidedPixels() const
InputPixelType ComputeMaximumInputValue()
typename InputImageType::ConstPointer InputImagePointer
Light weight base class for most itk classes.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....