ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkHoughTransform2DLinesImageFilter.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 __itkHoughTransform2DLinesImageFilter_h
00019 #define __itkHoughTransform2DLinesImageFilter_h
00020 
00021 
00022 #include "itkImageToImageFilter.h"
00023 #include "itkLineSpatialObject.h"
00024 
00025 namespace itk
00026 {
00061 template< typename TInputPixelType, typename TOutputPixelType >
00062 class ITK_EXPORT HoughTransform2DLinesImageFilter:
00063   public ImageToImageFilter< Image< TInputPixelType, 2 >, Image< TOutputPixelType, 2 > >
00064 {
00065 public:
00066 
00068   typedef HoughTransform2DLinesImageFilter Self;
00069 
00071   typedef Image< TInputPixelType, 2 >           InputImageType;
00072   typedef typename InputImageType::Pointer      InputImagePointer;
00073   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00074 
00076   typedef Image< TOutputPixelType, 2 >      OutputImageType;
00077   typedef typename OutputImageType::Pointer OutputImagePointer;
00078 
00080   typedef SmartPointer< Self >       Pointer;
00081   typedef SmartPointer< const Self > ConstPointer;
00082 
00084   typedef LineSpatialObject< 2 >     LineType;
00085   typedef typename LineType::Pointer LinePointer;
00086   typedef std::list< LinePointer >   LinesListType;
00087   typedef LineType::LinePointType    LinePointType;
00088 
00089   typedef typename LinesListType::size_type LinesListSizeType;
00090 
00092   typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
00093 
00095   typedef typename InputImageType::IndexType IndexType;
00096 
00098   typedef typename InputImageType::PixelType PixelType;
00099 
00101   typedef typename InputImageType::RegionType OutputImageRegionType;
00102 
00104   itkTypeMacro(HoughTransform2DLinesImageFilter, ImageToImageFilter);
00105 
00107   itkNewMacro(Self);
00108 
00110   void GenerateData();
00111 
00114   itkSetMacro(Threshold, float);
00115 
00117   itkGetConstMacro(Threshold, float);
00118 
00122   itkSetMacro(AngleResolution, float);
00123 
00125   itkGetConstMacro(AngleResolution, float);
00126 
00128   void Simplify(void);
00129 
00131   itkGetObjectMacro(SimplifyAccumulator, OutputImageType);
00132 
00134   LinesListType & GetLines(unsigned int n = 0);
00135 
00137   itkSetMacro(NumberOfLines, unsigned int);
00138   itkGetConstMacro(NumberOfLines, unsigned int);
00140 
00143   itkSetMacro(DiscRadius, float);
00144   itkGetConstMacro(DiscRadius, float);
00146 
00148   itkSetMacro(Variance, float);
00149   itkGetConstMacro(Variance, float);
00151 
00152 #ifdef ITK_USE_CONCEPT_CHECKING
00153 
00154   itkConceptMacro( IntConvertibleToOutputCheck,
00155                    ( Concept::Convertible< int, TOutputPixelType > ) );
00156   itkConceptMacro( InputGreaterThanFloatCheck,
00157                    ( Concept::GreaterThanComparable< PixelType, float > ) );
00158   itkConceptMacro( OutputPlusIntCheck,
00159                    ( Concept::AdditiveOperators< TOutputPixelType, int > ) );
00160 
00162 #endif
00163 protected:
00164 
00165   HoughTransform2DLinesImageFilter();
00166   virtual ~HoughTransform2DLinesImageFilter() {}
00167 
00168   void PrintSelf(std::ostream & os, Indent indent) const;
00169 
00173   void GenerateInputRequestedRegion();
00174 
00181   void GenerateOutputInformation();
00182 
00184   void EnlargeOutputRequestedRegion(DataObject *output);
00185 
00186 private:
00187 
00188   HoughTransform2DLinesImageFilter(const Self &);
00189   void operator=(const Self &);
00190 
00191   float              m_AngleResolution;
00192   float              m_Threshold;
00193   OutputImagePointer m_SimplifyAccumulator;
00194   LinesListType      m_LinesList;
00195   LinesListSizeType  m_NumberOfLines;
00196   float              m_DiscRadius;
00197   float              m_Variance;
00198   unsigned long      m_OldModifiedTime;
00199   LinesListSizeType  m_OldNumberOfLines;
00200 };
00201 } // end namespace itk
00202 
00203 #ifndef ITK_MANUAL_INSTANTIATION
00204 #include "itkHoughTransform2DLinesImageFilter.hxx"
00205 #endif
00206 
00207 #endif
00208