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: 2009-04-23 03:53:35 $
00007   Version:   $Revision: 1.8 $
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   itkGetConstMacro( 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   void SetNarrowBand( NarrowBandType * ptr)
00135     {  
00136     if ( m_NarrowBand != ptr )
00137       {
00138       m_NarrowBand = ptr;
00139       this->Modified();
00140       }
00141     }
00142   
00143   NarrowBandPointer GetNarrowBand() const
00144     {
00145     return m_NarrowBand;
00146     }
00147   
00148 #ifdef ITK_USE_CONCEPT_CHECKING
00149 
00150   itkConceptMacro(SameDimensionCheck,
00151     (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00152   itkConceptMacro(SameTypeCheck,
00153     (Concept::SameType<PixelType, typename TOutputImage::PixelType>));
00154   itkConceptMacro(FloatConvertibleToPixelTypeCheck,
00155     (Concept::Convertible<float, PixelType>));
00156   itkConceptMacro(PixelTypeConvertibleToFloatCheck,
00157     (Concept::Convertible<PixelType, float>));
00158   itkConceptMacro(PixelTypeGreaterThanFloatCheck,
00159     (Concept::GreaterThanComparable<PixelType, float>));
00160   itkConceptMacro(PixelTypeLessThanFloatCheck,
00161     (Concept::LessThanComparable<PixelType, float>));
00162   itkConceptMacro(PixelTypeFloatAdditiveOperatorsCheck,
00163     (Concept::AdditiveOperators<PixelType, float, float>));
00164   itkConceptMacro(FloatGreaterThanPixelTypeCheck,
00165     (Concept::GreaterThanComparable<float, PixelType>));
00166   itkConceptMacro(FloatLessThanPixelTypeCheck,
00167     (Concept::LessThanComparable<float, PixelType>));
00168 
00170 #endif
00171 
00172 protected:
00173   FastChamferDistanceImageFilter();
00174   virtual ~FastChamferDistanceImageFilter() {};
00175   void PrintSelf(std::ostream& os, Indent indent) const;
00176   
00179   void GenerateDataND();  
00180 
00182   void GenerateData();  
00183 
00184 private:   
00185   FastChamferDistanceImageFilter(const Self&); //purposely not implemented
00186   void operator=(const Self&); //purposely not implemented
00187   
00188   float  m_MaximumDistance;
00189   
00191   float  m_Weights[ImageDimension];
00192 
00193   NarrowBandPointer m_NarrowBand;
00194   
00196   typename InputImageType::RegionType m_RegionToProcess;
00197 
00198   
00199 }; // end of FastChamferDistanceImageFilter class
00200 
00201 } //end namespace itk
00202 
00203 
00204 #ifndef ITK_MANUAL_INSTANTIATION
00205 #include "itkFastChamferDistanceImageFilter.txx"
00206 #endif
00207 
00208 #endif
00209 

Generated at Thu May 28 09:54:14 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000