00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkHoughTransform2DLinesImageFilter_h
00018 #define __itkHoughTransform2DLinesImageFilter_h
00019
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023
00024 #include "itkImageToImageFilter.h"
00025 #include "itkImage.h"
00026 #include "itkLineSpatialObject.h"
00027
00028 namespace itk
00029 {
00030
00060 template<typename TInputPixelType, typename TOutputPixelType>
00061 class ITK_EXPORT HoughTransform2DLinesImageFilter :
00062 public ImageToImageFilter< Image<TInputPixelType,2>, Image<TOutputPixelType,2> >
00063 {
00064 public:
00065
00067 typedef HoughTransform2DLinesImageFilter Self;
00068
00070 typedef Image<TInputPixelType,2> InputImageType;
00071 typedef typename InputImageType::Pointer InputImagePointer;
00072 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00073
00075 typedef Image<TOutputPixelType,2> OutputImageType;
00076 typedef typename OutputImageType::Pointer OutputImagePointer;
00077
00079 typedef SmartPointer<Self> Pointer;
00080 typedef SmartPointer<const Self> ConstPointer;
00081
00083 typedef LineSpatialObject<2> LineType;
00084 typedef typename LineType::Pointer LinePointer;
00085 typedef std::list<LinePointer> LinesListType;
00086 typedef LineType::LinePointType LinePointType;
00087
00089 typedef ImageToImageFilter<InputImageType, OutputImageType> Superclass;
00090
00092 typedef typename InputImageType::IndexType IndexType;
00093
00095 typedef typename InputImageType::PixelType PixelType;
00096
00098 typedef typename InputImageType::RegionType OutputImageRegionType;
00099
00101 itkTypeMacro( HoughTransform2DLinesImageFilter, ImageToImageFilter );
00102
00104 itkNewMacro(Self);
00105
00107 void GenerateData();
00108
00111 itkSetMacro(Threshold,float);
00112
00114 itkGetMacro(Threshold,float);
00115
00119 itkSetMacro(AngleResolution,float);
00120
00122 itkGetMacro(AngleResolution,float);
00123
00126 itkSetMacro(AngleAxisSize,unsigned int);
00127
00129 itkGetMacro(AngleAxisSize,float);
00130
00132 void Simplify(void);
00133
00135 itkGetObjectMacro(SimplifyAccumulator,OutputImageType);
00136
00138 LinesListType & GetLines(unsigned int n=0);
00139
00141 itkSetMacro(NumberOfLines,unsigned int);
00142 itkGetMacro(NumberOfLines,unsigned int);
00143
00146 itkSetMacro(DiscRadius,float);
00147 itkGetMacro(DiscRadius,float);
00148
00150 itkSetMacro(Variance,float);
00151 itkGetMacro(Variance,float);
00152
00153 protected:
00154
00155 HoughTransform2DLinesImageFilter();
00156 virtual ~HoughTransform2DLinesImageFilter() {};
00157
00158 HoughTransform2DLinesImageFilter(const Self&) {}
00159 void operator=(const Self&) {}
00160
00161 void PrintSelf(std::ostream& os, Indent indent) const;
00162
00166 void GenerateInputRequestedRegion();
00167
00174 void GenerateOutputInformation();
00175
00177 void EnlargeOutputRequestedRegion(DataObject *output);
00178
00179 private:
00180
00181 float m_AngleResolution;
00182 float m_Threshold;
00183 float m_AngleAxisSize;
00184 OutputImagePointer m_SimplifyAccumulator;
00185 LinesListType m_LinesList;
00186 unsigned int m_NumberOfLines;
00187 float m_DiscRadius;
00188 float m_Variance;
00189 unsigned long m_OldModifiedTime;
00190 unsigned long m_OldNumberOfLines;
00191 };
00192
00193 }
00194
00195 #ifndef ITK_MANUAL_INSTANTIATION
00196 #include "itkHoughTransform2DLinesImageFilter.txx"
00197 #endif
00198
00199 #endif