ITK  6.0.0
Insight Toolkit
itkThresholdMaximumConnectedComponentsImageFilter.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 itkThresholdMaximumConnectedComponentsImageFilter_h
19#define itkThresholdMaximumConnectedComponentsImageFilter_h
20
25#include "itkCastImageFilter.h"
26
27
28namespace itk
29{
73template <typename TInputImage, typename TOutputImage = TInputImage>
75 : public ImageToImageFilter<TInputImage, TOutputImage>
76{
77public:
78 ITK_DISALLOW_COPY_AND_MOVE(ThresholdMaximumConnectedComponentsImageFilter);
79
85
87 itkNewMacro(Self);
88
90 itkOverrideGetNameOfClassMacro(ThresholdMaximumConnectedComponentsImageFilter);
91
93 using PixelType = typename TInputImage::PixelType;
94 using OutputPixelType = typename TOutputImage::PixelType;
95
97 itkConceptMacro(PixelTypeComparable, (Concept::Comparable<PixelType>));
98
106 itkSetMacro(MinimumObjectSizeInPixels, unsigned int);
107 itkGetConstMacro(MinimumObjectSizeInPixels, unsigned int);
123 itkSetMacro(InsideValue, OutputPixelType);
124 itkSetMacro(OutsideValue, OutputPixelType);
125 itkSetMacro(UpperBoundary, PixelType);
126 itkGetConstMacro(InsideValue, OutputPixelType);
127 itkGetConstMacro(OutsideValue, OutputPixelType);
128 itkGetConstMacro(UpperBoundary, PixelType);
135 itkGetConstMacro(NumberOfObjects, SizeValueType);
136
140 itkGetConstMacro(ThresholdValue, PixelType);
141
143 using InputImageType = TInputImage;
146 using InputImagePixelType = typename InputImageType::PixelType;
147
149 using OutputImageType = TOutputImage;
152 using OutputImagePixelType = typename OutputImageType::PixelType;
153
154protected:
157 void
158 PrintSelf(std::ostream & os, Indent indent) const override;
159
169 void
170 GenerateData() override;
171
178
179private:
181 using FilterPixelType = unsigned int;
182
183 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
184
186
188
189 //
190 // Binary Threshold Filter
191 //
193
194 //
195 // Connected Components Filter
196 //
198
199 //
200 // Relabeled Components Filter
201 //
203
204 //
205 // Minimum maximum calculator
206 //
208
209 //
210 // Declare member variables for the filters of the internal pipeline.
211 //
212 typename ThresholdFilterType::Pointer m_ThresholdFilter{};
213 typename ConnectedFilterType::Pointer m_ConnectedComponent{};
214
215 typename RelabelFilterType::Pointer m_LabeledComponent{};
216
217 typename MinMaxCalculatorType::Pointer m_MinMaxCalculator{};
218
219 // Variables defined by the user
220 unsigned int m_MinimumObjectSizeInPixels{};
221
222 // Binary threshold variables
223 OutputPixelType m_OutsideValue{};
224 OutputPixelType m_InsideValue{};
225
226 PixelType m_LowerBoundary{};
227 PixelType m_UpperBoundary{};
228
229 // Filter variables
230 PixelType m_ThresholdValue{};
231 SizeValueType m_NumberOfObjects{};
232};
233} // end namespace itk
234
235#ifndef ITK_MANUAL_INSTANTIATION
236# include "itkThresholdMaximumConnectedComponentsImageFilter.hxx"
237#endif
238
239#endif
Binarize an input image by thresholding.
Label the objects in a binary image.
Base class for filters that take an image as input and produce an image as output.
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Computes the minimum and the maximum intensity values of an image.
Relabel the components in an image such that consecutive labels are used.
Finds the threshold value of an image based on maximizing the number of objects in the image that are...
void PrintSelf(std::ostream &os, Indent indent) const override
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86