Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkFastChamferDistanceImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFastChamferDistanceImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/03/24 13:39:24 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkFastChamferDistanceImageFilter_h
00018 #define __itkFastChamferDistanceImageFilter_h
00019 
00020 #include <itkImageToImageFilter.h>
00021 #include <itkImageRegionIteratorWithIndex.h>
00022 #include <itkNarrowBand.h>
00023 
00024 namespace itk
00025 {
00026 
00054 template < class TInputImage, class TOutputImage >
00055 class ITK_EXPORT FastChamferDistanceImageFilter :
00056     public ImageToImageFilter<TInputImage,TOutputImage>
00057 {
00058 public:
00060   typedef FastChamferDistanceImageFilter    Self;
00061   typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00062   typedef SmartPointer<Self> Pointer;
00063   typedef SmartPointer<const Self> ConstPointer;
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro( FastChamferDistanceImageFilter, ImageToImageFilter );
00070 
00072   typedef   TInputImage       InputImageType;
00073 
00075   typedef   TOutputImage      OutputImageType;
00076 
00078   typedef typename InputImageType::RegionType   RegionType;
00079 
00081   typedef typename InputImageType::PixelType   PixelType;
00082 
00084   typedef typename RegionType::IndexType  IndexType;
00085 
00087   typedef typename InputImageType::OffsetType  OffsetType;
00088 
00090   typedef typename RegionType::SizeType   SizeType;
00091 
00093   itkStaticConstMacro(ImageDimension, unsigned int,
00094                       InputImageType::ImageDimension);
00095   itkStaticConstMacro(OutputImageDimension, unsigned int,
00096                       OutputImageType::ImageDimension);
00098 
00100   typedef typename InputImageType::ConstPointer InputImagePointer;
00101 
00103   typedef BandNode<IndexType,PixelType> BandNodeType;
00104   typedef NarrowBand<BandNodeType> NarrowBandType;
00105   typedef typename NarrowBandType::Pointer NarrowBandPointer;
00106 
00107   
00109   itkSetVectorMacro( Weights, float, ImageDimension);
00110   itkGetVectorMacro( Weights, const float, ImageDimension);
00112 
00113   
00115   itkSetMacro( MaximumDistance, float);
00116   itkGetMacro( MaximumDistance, float);
00118 
00120   void SetRegionToProcess( const RegionType &r)
00121   {
00122     if ( m_RegionToProcess != r)
00123       {
00124       m_RegionToProcess = r;
00125       this->Modified();
00126       }      
00127   }
00128   RegionType GetRegionToProcess() const
00129   {
00130     return m_RegionToProcess;
00131   }
00133 
00134   
00135   void SetNarrowBand( NarrowBandType * ptr)
00136   {  
00137     if ( m_NarrowBand != ptr )
00138       {
00139       m_NarrowBand = ptr;
00140       this->Modified();
00141       }
00142   }
00143   
00144   NarrowBandPointer GetNarrowBand() const
00145   { return m_NarrowBand; }
00146   
00147 #ifdef ITK_USE_CONCEPT_CHECKING
00148 
00149   itkConceptMacro(SameDimensionCheck,
00150     (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00151   itkConceptMacro(SameTypeCheck,
00152     (Concept::SameType<PixelType, typename TOutputImage::PixelType>));
00153   itkConceptMacro(FloatConvertibleToPixelTypeCheck,
00154     (Concept::Convertible<float, PixelType>));
00155   itkConceptMacro(PixelTypeConvertibleToFloatCheck,
00156     (Concept::Convertible<PixelType, float>));
00157   itkConceptMacro(PixelTypeGreaterThanFloatCheck,
00158     (Concept::GreaterThanComparable<PixelType, float>));
00159   itkConceptMacro(PixelTypeLessThanFloatCheck,
00160     (Concept::LessThanComparable<PixelType, float>));
00161   itkConceptMacro(PixelTypeFloatAdditiveOperatorsCheck,
00162     (Concept::AdditiveOperators<PixelType, float, float>));
00163   itkConceptMacro(FloatGreaterThanPixelTypeCheck,
00164     (Concept::GreaterThanComparable<float, PixelType>));
00165   itkConceptMacro(FloatLessThanPixelTypeCheck,
00166     (Concept::LessThanComparable<float, PixelType>));
00167 
00169 #endif
00170 
00171 protected:
00172   FastChamferDistanceImageFilter();
00173   virtual ~FastChamferDistanceImageFilter() {};
00174   void PrintSelf(std::ostream& os, Indent indent) const;
00175   
00178   void GenerateDataND();  
00179 
00181   void GenerateData();  
00182 
00183 private:   
00184   FastChamferDistanceImageFilter(const Self&); //purposely not implemented
00185   void operator=(const Self&); //purposely not implemented
00186   
00187   float  m_MaximumDistance;
00188   
00190   float  m_Weights[ImageDimension];
00191 
00192   NarrowBandPointer m_NarrowBand;
00193   
00195   typename InputImageType::RegionType m_RegionToProcess;
00196 
00197   
00198 }; // end of FastChamferDistanceImageFilter class
00199 
00200 } //end namespace itk
00201 
00202 
00203 #ifndef ITK_MANUAL_INSTANTIATION
00204 #include "itkFastChamferDistanceImageFilter.txx"
00205 #endif
00206 
00207 #endif
00208 

Generated at Wed Nov 5 21:18:32 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000