00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __itkThresholdMaximumConnectedComponentsImageFilter_h
00022 #define __itkThresholdMaximumConnectedComponentsImageFilter_h
00023
00024 #include "itkInPlaceImageFilter.h"
00025 #include "itkBinaryThresholdImageFilter.h"
00026 #include "itkConnectedComponentImageFilter.h"
00027 #include "itkRelabelComponentImageFilter.h"
00028 #include "itkMinimumMaximumImageCalculator.h"
00029 #include "itkCastImageFilter.h"
00030
00031 #include "itkConceptChecking.h"
00032
00033 namespace itk
00034 {
00035
00077 template <class TInputImage>
00078 class ITK_EXPORT ThresholdMaximumConnectedComponentsImageFilter :
00079 public ImageToImageFilter< TInputImage , TInputImage >
00080 {
00081 public:
00083 typedef ThresholdMaximumConnectedComponentsImageFilter Self;
00084 typedef ImageToImageFilter<TInputImage,TInputImage> Superclass;
00085 typedef SmartPointer<Self> Pointer;
00086 typedef SmartPointer<const Self> ConstPointer;
00087
00089 itkNewMacro(Self);
00090
00092 itkTypeMacro( ThresholdMaximumConnectedComponentsImageFilter,
00093 ImageToImageFilter );
00094
00096 typedef typename TInputImage::PixelType PixelType;
00097
00099 itkConceptMacro(PixelTypeComparable, (Concept::Comparable<PixelType>));
00100
00108 itkSetMacro( MinimumObjectSizeInPixels, unsigned int );
00109 itkGetMacro( MinimumObjectSizeInPixels, unsigned int );
00111
00125 itkSetMacro( InsideValue, PixelType );
00126 itkSetMacro( OutsideValue, PixelType );
00127 itkSetMacro( UpperBoundary, PixelType );
00128 itkGetMacro( InsideValue, PixelType );
00129 itkGetMacro( OutsideValue, PixelType );
00130 itkGetMacro( UpperBoundary, PixelType );
00132
00137 itkGetMacro( NumberOfObjects, unsigned long );
00138
00142 itkGetMacro( ThresholdValue, PixelType );
00143
00145 typedef TInputImage InputImageType;
00146 typedef typename InputImageType::ConstPointer InputImagePointer;
00147 typedef typename InputImageType::RegionType InputImageRegionType;
00148 typedef typename InputImageType::PixelType InputImagePixelType;
00149
00151 typedef TInputImage OutputImageType;
00152 typedef typename OutputImageType::Pointer OutputImagePointer;
00153 typedef typename OutputImageType::RegionType OutputImageRegionType;
00154 typedef typename OutputImageType::PixelType OutputImagePixelType;
00155
00156
00157 protected:
00158 ThresholdMaximumConnectedComponentsImageFilter();
00159 ~ThresholdMaximumConnectedComponentsImageFilter() {};
00160 void PrintSelf(std::ostream& os, Indent indent) const;
00161
00164 void GenerateData(void);
00165
00170 unsigned long int ComputeConnectedComponents(void);
00171
00172
00173 private:
00174
00176 typedef unsigned int FilterPixelType;
00177
00178 itkStaticConstMacro( ImageDimension,
00179 unsigned int,
00180 TInputImage::ImageDimension );
00181
00182 typedef itk::Image< FilterPixelType, itkGetStaticConstMacro(ImageDimension) >
00183 FilterImageType;
00184
00185 typedef typename FilterImageType::Pointer FilterImagePointer;
00186
00187
00188 ThresholdMaximumConnectedComponentsImageFilter(const Self&);
00189 void operator=(const Self&);
00190
00191
00192
00193
00194
00195 typedef BinaryThresholdImageFilter< InputImageType, InputImageType >
00196 ThresholdFilterType;
00197
00198
00199
00200
00201
00202 typedef ConnectedComponentImageFilter< InputImageType, FilterImageType >
00203 ConnectedFilterType;
00204
00205
00206
00207
00208
00209 typedef RelabelComponentImageFilter< FilterImageType, FilterImageType >
00210 RelabelFilterType;
00211
00212
00213
00214
00215
00216 typedef MinimumMaximumImageCalculator< InputImageType > MinMaxCalculatorType;
00217
00218
00219
00220
00221 typename ThresholdFilterType::Pointer m_ThresholdFilter;
00222 typename ConnectedFilterType::Pointer m_ConnectedComponent;
00223 typename RelabelFilterType::Pointer m_LabeledComponent;
00224 typename MinMaxCalculatorType::Pointer m_MinMaxCalculator;
00225
00226
00227 unsigned int m_MinimumObjectSizeInPixels;
00228
00229
00230 PixelType m_OutsideValue;
00231 PixelType m_InsideValue;
00232 PixelType m_LowerBoundary;
00233 PixelType m_UpperBoundary;
00234
00235
00236 PixelType m_ThresholdValue;
00237 unsigned long m_NumberOfObjects;
00238
00239 };
00240
00241
00242 }
00243
00244 #ifndef ITK_MANUAL_INSTANTIATION
00245 #include "itkThresholdMaximumConnectedComponentsImageFilter.txx"
00246 #endif
00247
00248 #endif
00249