00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkHoughTransform2DCirclesImageFilter_h
00018 #define __itkHoughTransform2DCirclesImageFilter_h
00019
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023
00024 #include "itkImageToImageFilter.h"
00025 #include "itkImage.h"
00026 #include "itkEllipseSpatialObject.h"
00027
00028 namespace itk
00029 {
00030
00052 template<typename TInputPixelType, typename TOutputPixelType>
00053 class ITK_EXPORT HoughTransform2DCirclesImageFilter :
00054 public ImageToImageFilter< Image<TInputPixelType,2>, Image<TOutputPixelType,2> >
00055 {
00056 public:
00057
00059 typedef HoughTransform2DCirclesImageFilter Self;
00060
00062 typedef Image<TInputPixelType,2> InputImageType;
00063 typedef typename InputImageType::Pointer InputImagePointer;
00064 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00065
00067 typedef Image<TOutputPixelType,2> OutputImageType;
00068 typedef typename OutputImageType::Pointer OutputImagePointer;
00069
00070
00072 typedef ImageToImageFilter< Image<TInputPixelType,2>
00073 , Image<TOutputPixelType,2> > Superclass;
00074
00076 typedef SmartPointer<Self> Pointer;
00077 typedef SmartPointer<const Self> ConstPointer;
00078
00080 typedef typename InputImageType::IndexType IndexType;
00081
00083 typedef typename InputImageType::PixelType PixelType;
00084
00086 typedef typename InputImageType::RegionType OutputImageRegionType;
00087
00089 typedef EllipseSpatialObject<2> CircleType;
00090 typedef typename CircleType::Pointer CirclePointer;
00091 typedef std::list<CirclePointer> CirclesListType;
00092
00094 itkTypeMacro( HoughTransform2DCirclesImageFilter, ImageToImageFilter );
00095
00097 itkNewMacro(Self);
00098
00100 void GenerateData();
00101
00103 void SetRadius(double radius);
00104
00106 itkSetMacro(MinimumRadius,double);
00107
00109 itkSetMacro(MaximumRadius,double);
00110
00113 itkSetMacro(Threshold,double);
00114
00116 itkGetMacro(Threshold,double);
00117
00119 itkGetObjectMacro(RadiusImage,OutputImageType);
00120
00122 itkSetMacro(SigmaGradient,double);
00123
00125 itkGetMacro(SigmaGradient,double);
00126
00128 CirclesListType & GetCircles(unsigned int n=0);
00129
00131 itkSetMacro(NumberOfCircles,unsigned int);
00132 itkGetMacro(NumberOfCircles,unsigned int);
00134
00137 itkSetMacro(DiscRadiusRatio,float);
00138 itkGetMacro(DiscRadiusRatio,float);
00140
00142 itkSetMacro(Variance,float);
00143 itkGetMacro(Variance,float);
00145
00147 itkSetMacro(SweepAngle,float);
00148 itkGetMacro(SweepAngle,float);
00150
00151 #ifdef ITK_USE_CONCEPT_CHECKING
00152
00153 itkConceptMacro(IntConvertibleToOutputCheck,
00154 (Concept::Convertible<int, TOutputPixelType>));
00155 itkConceptMacro(InputGreaterThanDoubleCheck,
00156 (Concept::GreaterThanComparable<PixelType, double>));
00157 itkConceptMacro(OutputPlusIntCheck,
00158 (Concept::AdditiveOperators<TOutputPixelType, int>));
00159 itkConceptMacro(OutputDividedByIntCheck,
00160 (Concept::DivisionOperators<TOutputPixelType, int>));
00161
00163 #endif
00164
00165 protected:
00166
00167 HoughTransform2DCirclesImageFilter();
00168 virtual ~HoughTransform2DCirclesImageFilter() {};
00169
00170 HoughTransform2DCirclesImageFilter(const Self&) {}
00171 void operator=(const Self&) {}
00172
00173 void PrintSelf(std::ostream& os, Indent indent) const;
00174
00178 void GenerateInputRequestedRegion();
00179
00184 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00185
00186 private:
00187
00188 float m_SweepAngle;
00189 double m_MinimumRadius;
00190 double m_MaximumRadius;
00191 double m_Threshold;
00192 double m_SigmaGradient;
00193 OutputImagePointer m_RadiusImage;
00194 CirclesListType m_CirclesList;
00195 unsigned int m_NumberOfCircles;
00196 float m_DiscRadiusRatio;
00197 float m_Variance;
00198 unsigned long m_OldModifiedTime;
00199 unsigned long m_OldNumberOfCircles;
00200
00201 };
00202
00203 }
00204
00205 #ifndef ITK_MANUAL_INSTANTIATION
00206 #include "itkHoughTransform2DCirclesImageFilter.txx"
00207 #endif
00208
00209 #endif
00210