ITK  5.4.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 
28 namespace itk
29 {
73 template <typename TInputImage, typename TOutputImage = TInputImage>
75  : public ImageToImageFilter<TInputImage, TOutputImage>
76 {
77 public:
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 
154 protected:
157  void
158  PrintSelf(std::ostream & os, Indent indent) const override;
159 
169  void
170  GenerateData() override;
171 
177  ComputeConnectedComponents();
178 
179 private:
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::ThresholdMaximumConnectedComponentsImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkThresholdMaximumConnectedComponentsImageFilter.h:94
itk::ThresholdMaximumConnectedComponentsImageFilter::FilterPixelType
unsigned int FilterPixelType
Definition: itkThresholdMaximumConnectedComponentsImageFilter.h:181
itk::MinimumMaximumImageCalculator
Computes the minimum and the maximum intensity values of an image.
Definition: itkMinimumMaximumImageCalculator.h:45
itk::BinaryThresholdImageFilter
Binarize an input image by thresholding.
Definition: itkBinaryThresholdImageFilter.h:132
itkMinimumMaximumImageCalculator.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkCastImageFilter.h
itkRelabelComponentImageFilter.h
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
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::ThresholdMaximumConnectedComponentsImageFilter::PixelType
typename TInputImage::PixelType PixelType
Definition: itkThresholdMaximumConnectedComponentsImageFilter.h:93
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ThresholdMaximumConnectedComponentsImageFilter::FilterImagePointer
typename FilterImageType::Pointer FilterImagePointer
Definition: itkThresholdMaximumConnectedComponentsImageFilter.h:187
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::Concept::Comparable
Definition: itkConceptChecking.h:330
itk::ThresholdMaximumConnectedComponentsImageFilter
Finds the threshold value of an image based on maximizing the number of objects in the image that are...
Definition: itkThresholdMaximumConnectedComponentsImageFilter.h:74
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::RelabelComponentImageFilter
Relabel the components in an image such that consecutive labels are used.
Definition: itkRelabelComponentImageFilter.h:82
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itkConnectedComponentImageFilter.h
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itkBinaryThresholdImageFilter.h
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::ConnectedComponentImageFilter
Label the objects in a binary image.
Definition: itkConnectedComponentImageFilter.h:59
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90