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
00125 void Simplify(void);
00126
00128 itkGetObjectMacro(SimplifyAccumulator,OutputImageType);
00129
00131 LinesListType & GetLines(unsigned int n=0);
00132
00134 itkSetMacro(NumberOfLines,unsigned int);
00135 itkGetMacro(NumberOfLines,unsigned int);
00136
00139 itkSetMacro(DiscRadius,float);
00140 itkGetMacro(DiscRadius,float);
00141
00143 itkSetMacro(Variance,float);
00144 itkGetMacro(Variance,float);
00145
00146 protected:
00147
00148 HoughTransform2DLinesImageFilter();
00149 virtual ~HoughTransform2DLinesImageFilter() {};
00150
00151 HoughTransform2DLinesImageFilter(const Self&) {}
00152 void operator=(const Self&) {}
00153
00154 void PrintSelf(std::ostream& os, Indent indent) const;
00155
00159 void GenerateInputRequestedRegion();
00160
00167 void GenerateOutputInformation();
00168
00170 void EnlargeOutputRequestedRegion(DataObject *output);
00171
00172 private:
00173
00174 float m_AngleResolution;
00175 float m_Threshold;
00176 OutputImagePointer m_SimplifyAccumulator;
00177 LinesListType m_LinesList;
00178 unsigned int m_NumberOfLines;
00179 float m_DiscRadius;
00180 float m_Variance;
00181 unsigned long m_OldModifiedTime;
00182 unsigned long m_OldNumberOfLines;
00183 };
00184
00185 }
00186
00187 #ifndef ITK_MANUAL_INSTANTIATION
00188 #include "itkHoughTransform2DLinesImageFilter.txx"
00189 #endif
00190
00191 #endif