ITK  4.12.0
Insight Segmentation and Registration Toolkit
itkThresholdMaximumConnectedComponentsImageFilter.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 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:
83 
85  itkNewMacro(Self);
86 
90 
92  typedef typename TInputImage::PixelType PixelType;
93  typedef typename TOutputImage::PixelType OutputPixelType;
94 
96  itkConceptMacro( PixelTypeComparable, ( Concept::Comparable< PixelType > ) );
97 
105  itkSetMacro(MinimumObjectSizeInPixels, unsigned int);
106  itkGetConstMacro(MinimumObjectSizeInPixels, unsigned int);
108 
122  itkSetMacro(InsideValue, OutputPixelType);
123  itkSetMacro(OutsideValue, OutputPixelType);
124  itkSetMacro(UpperBoundary, PixelType);
125  itkGetConstMacro(InsideValue, OutputPixelType);
126  itkGetConstMacro(OutsideValue, OutputPixelType);
127  itkGetConstMacro(UpperBoundary, PixelType);
129 
134  itkGetConstMacro(NumberOfObjects, SizeValueType);
135 
139  itkGetConstMacro(ThresholdValue, PixelType);
140 
142  typedef TInputImage InputImageType;
144  typedef typename InputImageType::RegionType InputImageRegionType;
145  typedef typename InputImageType::PixelType InputImagePixelType;
146 
148  typedef TOutputImage OutputImageType;
150  typedef typename OutputImageType::RegionType OutputImageRegionType;
151  typedef typename OutputImageType::PixelType OutputImagePixelType;
152 
153 protected:
156  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
157 
158  void GenerateData(void) ITK_OVERRIDE;
159 
164  SizeValueType ComputeConnectedComponents();
165 
166 private:
167 
169  typedef unsigned int FilterPixelType;
170 
171  itkStaticConstMacro(ImageDimension,
172  unsigned int,
173  TInputImage::ImageDimension);
174 
175  typedef itk::Image< FilterPixelType, itkGetStaticConstMacro(ImageDimension) >
177 
179 
180  ITK_DISALLOW_COPY_AND_ASSIGN(ThresholdMaximumConnectedComponentsImageFilter);
181 
182  //
183  // Binary Threshold Filter
184  //
187 
188  //
189  // Connected Components Filter
190  //
193 
194  //
195  // Relabeled Components Filter
196  //
197  typedef RelabelComponentImageFilter< FilterImageType, FilterImageType >
199 
200  //
201  // Minimum maximum calculator
202  //
204 
205  //
206  // Declare member variables for the filters of the internal pipeline.
207  //
208  typename ThresholdFilterType::Pointer m_ThresholdFilter;
209  typename ConnectedFilterType::Pointer m_ConnectedComponent;
210 
211  typename RelabelFilterType::Pointer m_LabeledComponent;
212 
213  typename MinMaxCalculatorType::Pointer m_MinMaxCalculator;
214 
215  // Variables defined by the user
216  unsigned int m_MinimumObjectSizeInPixels;
217 
218  // Binary threshold variables
220  OutputPixelType m_InsideValue;
221 
222  PixelType m_LowerBoundary;
223  PixelType m_UpperBoundary;
224 
225  // Filter variables
226  PixelType m_ThresholdValue;
227  SizeValueType m_NumberOfObjects;
228 };
229 } // end namespace itk
230 
231 #ifndef ITK_MANUAL_INSTANTIATION
232 #include "itkThresholdMaximumConnectedComponentsImageFilter.hxx"
233 #endif
234 
235 #endif
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
SmartPointer< Self > Pointer
Binarize an input image by thresholding.
Finds the threshold value of an image based on maximizing the number of objects in the image that are...
SmartPointer< const Self > ConstPointer
Computes the minimum and the maximum intensity values of an image.
Relabel the components in an image such that consecutive labels are used.
TOutput m_OutsideValue
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
TOutputImage OutputImageType
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75
Label the objects in a binary image.