ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkHoughTransform2DCirclesImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkHoughTransform2DCirclesImageFilter_h
00019 #define __itkHoughTransform2DCirclesImageFilter_h
00020 
00021 
00022 #include "itkImageToImageFilter.h"
00023 #include "itkEllipseSpatialObject.h"
00024 
00025 namespace itk
00026 {
00053 template< typename TInputPixelType, typename TOutputPixelType >
00054 class ITK_EXPORT HoughTransform2DCirclesImageFilter:
00055   public ImageToImageFilter< Image< TInputPixelType, 2 >, Image< TOutputPixelType, 2 > >
00056 {
00057 public:
00058 
00060   typedef HoughTransform2DCirclesImageFilter Self;
00061 
00063   typedef Image< TInputPixelType, 2 >           InputImageType;
00064   typedef typename InputImageType::Pointer      InputImagePointer;
00065   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00066 
00068   typedef Image< TOutputPixelType, 2 >      OutputImageType;
00069   typedef typename OutputImageType::Pointer OutputImagePointer;
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 
00094   typedef typename CirclesListType::size_type CirclesListSizeType;
00095 
00097   itkTypeMacro(HoughTransform2DCirclesImageFilter, ImageToImageFilter);
00098 
00100   itkNewMacro(Self);
00101 
00103   void GenerateData();
00104 
00106   void SetRadius(double radius);
00107 
00109   itkSetMacro(MinimumRadius, double);
00110 
00112   itkSetMacro(MaximumRadius, double);
00113 
00116   itkSetMacro(Threshold, double);
00117 
00119   itkGetConstMacro(Threshold, double);
00120 
00122   itkGetObjectMacro(RadiusImage, OutputImageType);
00123 
00125   itkSetMacro(SigmaGradient, double);
00126 
00128   itkGetConstMacro(SigmaGradient, double);
00129 
00131   CirclesListType & GetCircles(unsigned int n = 0);
00132 
00134   itkSetMacro(NumberOfCircles, unsigned int);
00135   itkGetConstMacro(NumberOfCircles, unsigned int);
00137 
00140   itkSetMacro(DiscRadiusRatio, float);
00141   itkGetConstMacro(DiscRadiusRatio, float);
00143 
00145   itkSetMacro(Variance, float);
00146   itkGetConstMacro(Variance, float);
00148 
00150   itkSetMacro(SweepAngle, float);
00151   itkGetConstMacro(SweepAngle, float);
00153 
00154 #ifdef ITK_USE_CONCEPT_CHECKING
00155 
00156   itkConceptMacro( IntConvertibleToOutputCheck,
00157                    ( Concept::Convertible< int, TOutputPixelType > ) );
00158   itkConceptMacro( InputGreaterThanDoubleCheck,
00159                    ( Concept::GreaterThanComparable< PixelType, double > ) );
00160   itkConceptMacro( OutputPlusIntCheck,
00161                    ( Concept::AdditiveOperators< TOutputPixelType, int > ) );
00162   itkConceptMacro( OutputDividedByIntCheck,
00163                    ( Concept::DivisionOperators< TOutputPixelType, int > ) );
00164 
00166 #endif
00167 protected:
00168 
00169   HoughTransform2DCirclesImageFilter();
00170   virtual ~HoughTransform2DCirclesImageFilter() {}
00171 
00172   void PrintSelf(std::ostream & os, Indent indent) const;
00173 
00177   void GenerateInputRequestedRegion();
00178 
00183   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00184 private:
00185 
00186   HoughTransform2DCirclesImageFilter(const Self &);
00187   void operator=(const Self &);
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   CirclesListSizeType   m_NumberOfCircles;
00198   float                 m_DiscRadiusRatio;
00199   float                 m_Variance;
00200   unsigned long         m_OldModifiedTime;
00201 
00202   CirclesListSizeType m_OldNumberOfCircles;
00203 };
00204 } // end namespace itk
00205 
00206 #ifndef ITK_MANUAL_INSTANTIATION
00207 #include "itkHoughTransform2DCirclesImageFilter.hxx"
00208 #endif
00209 
00210 #endif
00211