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 itkGetConstMacro(Threshold,float);
00115
00119 itkSetMacro(AngleResolution,float);
00120
00122 itkGetConstMacro(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 itkGetConstMacro(NumberOfLines,unsigned int);
00137
00140 itkSetMacro(DiscRadius,float);
00141 itkGetConstMacro(DiscRadius,float);
00143
00145 itkSetMacro(Variance,float);
00146 itkGetConstMacro(Variance,float);
00148
00149 #ifdef ITK_USE_CONCEPT_CHECKING
00150
00151 itkConceptMacro(IntConvertibleToOutputCheck,
00152 (Concept::Convertible<int, TOutputPixelType>));
00153 itkConceptMacro(InputGreaterThanFloatCheck,
00154 (Concept::GreaterThanComparable<PixelType, float>));
00155 itkConceptMacro(OutputPlusIntCheck,
00156 (Concept::AdditiveOperators<TOutputPixelType, int>));
00157
00159 #endif
00160
00161 protected:
00162
00163 HoughTransform2DLinesImageFilter();
00164 virtual ~HoughTransform2DLinesImageFilter() {};
00165
00166 HoughTransform2DLinesImageFilter(const Self&) {}
00167 void operator=(const Self&) {}
00168
00169 void PrintSelf(std::ostream& os, Indent indent) const;
00170
00174 void GenerateInputRequestedRegion();
00175
00182 void GenerateOutputInformation();
00183
00185 void EnlargeOutputRequestedRegion(DataObject *output);
00186
00187 private:
00188
00189 float m_AngleResolution;
00190 float m_Threshold;
00191 OutputImagePointer m_SimplifyAccumulator;
00192 LinesListType m_LinesList;
00193 unsigned int m_NumberOfLines;
00194 float m_DiscRadius;
00195 float m_Variance;
00196 unsigned long m_OldModifiedTime;
00197 unsigned long m_OldNumberOfLines;
00198 };
00199
00200 }
00201
00202 #ifndef ITK_MANUAL_INSTANTIATION
00203 #include "itkHoughTransform2DLinesImageFilter.txx"
00204 #endif
00205
00206 #endif
00207