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<
00073 Image<TInputPixelType,2>
00074 , Image<TOutputPixelType,2> > Superclass;
00075
00077 typedef SmartPointer<Self> Pointer;
00078 typedef SmartPointer<const Self> ConstPointer;
00079
00081 typedef typename InputImageType::IndexType IndexType;
00082
00084 typedef typename InputImageType::PixelType PixelType;
00085
00087 typedef typename InputImageType::RegionType OutputImageRegionType;
00088
00090 typedef EllipseSpatialObject<2> CircleType;
00091 typedef typename CircleType::Pointer CirclePointer;
00092 typedef std::list<CirclePointer> CirclesListType;
00093
00095 itkTypeMacro( HoughTransform2DCirclesImageFilter, ImageToImageFilter );
00096
00098 itkNewMacro(Self);
00099
00101 void GenerateData();
00102
00104 void SetRadius(double radius);
00105
00107 itkSetMacro(MinimumRadius,double);
00108
00110 itkSetMacro(MaximumRadius,double);
00111
00114 itkSetMacro(Threshold,double);
00115
00117 itkGetMacro(Threshold,double);
00118
00120 itkGetObjectMacro(RadiusImage,OutputImageType);
00121
00123 itkSetMacro(SigmaGradient,double);
00124
00126 itkGetMacro(SigmaGradient,double);
00127
00129 CirclesListType & GetCircles(unsigned int n=0);
00130
00132 itkSetMacro(NumberOfCircles,unsigned int);
00133 itkGetMacro(NumberOfCircles,unsigned int);
00135
00138 itkSetMacro(DiscRadiusRatio,float);
00139 itkGetMacro(DiscRadiusRatio,float);
00141
00143 itkSetMacro(Variance,float);
00144 itkGetMacro(Variance,float);
00146
00148 itkSetMacro(SweepAngle,float);
00149 itkGetMacro(SweepAngle,float);
00151
00152 #ifdef ITK_USE_CONCEPT_CHECKING
00153
00154 itkConceptMacro(IntConvertibleToOutputCheck,
00155 (Concept::Convertible<int, TOutputPixelType>));
00156 itkConceptMacro(InputGreaterThanDoubleCheck,
00157 (Concept::GreaterThanComparable<PixelType, double>));
00158 itkConceptMacro(OutputPlusIntCheck,
00159 (Concept::AdditiveOperators<TOutputPixelType, int>));
00160 itkConceptMacro(OutputDividedByIntCheck,
00161 (Concept::DivisionOperators<TOutputPixelType, int>));
00162
00164 #endif
00165
00166 protected:
00167
00168 HoughTransform2DCirclesImageFilter();
00169 virtual ~HoughTransform2DCirclesImageFilter() {};
00170
00171 HoughTransform2DCirclesImageFilter(const Self&) {}
00172 void operator=(const Self&) {}
00173
00174 void PrintSelf(std::ostream& os, Indent indent) const;
00175
00179 void GenerateInputRequestedRegion();
00180
00185 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00186
00187 private:
00188
00189 float m_SweepAngle;
00190 double m_MinimumRadius;
00191 double m_MaximumRadius;
00192 double m_Threshold;
00193 double m_SigmaGradient;
00194
00195 OutputImagePointer m_RadiusImage;
00196 CirclesListType m_CirclesList;
00197 unsigned int m_NumberOfCircles;
00198 float m_DiscRadiusRatio;
00199 float m_Variance;
00200 unsigned long m_OldModifiedTime;
00201 unsigned long m_OldNumberOfCircles;
00202
00203 };
00204
00205 }
00206
00207 #ifndef ITK_MANUAL_INSTANTIATION
00208 #include "itkHoughTransform2DCirclesImageFilter.txx"
00209 #endif
00210
00211 #endif
00212