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