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

itkFastIncrementalBinaryDilateImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFastIncrementalBinaryDilateImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/08/24 11:05:36 $
00007   Version:   $Revision: 1.3 $
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 __itkFastIncrementalBinaryDilateImageFilter_h
00018 #define __itkFastIncrementalBinaryDilateImageFilter_h
00019 
00020 #include <vector>
00021 #include <queue>
00022 #include "itkImageToImageFilter.h"
00023 #include "itkImage.h"
00024 #include "itkNumericTraits.h"
00025 #include "itkNeighborhoodIterator.h"
00026 #include "itkConstNeighborhoodIterator.h"
00027 #include "itkNeighborhood.h"
00028 #include "itkImageBoundaryCondition.h"
00029 #include "itkImageRegionIterator.h"
00030 #include "itkConceptChecking.h"
00031 
00032 namespace itk
00033 {
00102 template <class TInputImage, class TOutputImage, class TKernel>
00103 class ITK_EXPORT FastIncrementalBinaryDilateImageFilter :
00104     public ImageToImageFilter< TInputImage, TOutputImage >
00105 {
00106 public:
00108   itkStaticConstMacro(InputImageDimension, unsigned int,
00109                       TInputImage::ImageDimension);
00110   itkStaticConstMacro(OutputImageDimension, unsigned int,
00111                       TOutputImage::ImageDimension);
00112 
00114   itkStaticConstMacro(KernelDimension, unsigned int,
00115                       TKernel::NeighborhoodDimension);
00116   
00118   typedef TInputImage InputImageType;
00119   typedef TOutputImage OutputImageType;
00120 
00122   typedef FastIncrementalBinaryDilateImageFilter Self;
00123   typedef ImageToImageFilter< InputImageType, OutputImageType> Superclass;
00124   typedef SmartPointer<Self> Pointer;
00125   typedef SmartPointer<const Self>  ConstPointer;
00126 
00128   itkNewMacro(Self);
00129 
00131   itkTypeMacro(FastIncrementalBinaryDilateImageFilter, ImageToImageFilter);
00132 
00134   typedef TKernel KernelType;
00135 
00137   typedef typename KernelType::ConstIterator KernelIteratorType ;
00138 
00140   typedef typename InputImageType::PixelType InputPixelType;
00141   typedef typename OutputImageType::PixelType OutputPixelType;
00142   typedef typename NumericTraits<InputPixelType>::RealType InputRealType;
00143   typedef typename InputImageType::OffsetType OffsetType;
00144   typedef typename InputImageType::IndexType IndexType;
00145 
00146   typedef typename InputImageType::RegionType InputImageRegionType;
00147   typedef typename OutputImageType::RegionType OutputImageRegionType;
00148   typedef typename InputImageType::SizeType InputSizeType;
00149 
00151   itkConceptMacro(ImageDimensionCheck,
00152       (Concept::SameDimension<itkGetStaticConstMacro(InputImageDimension),
00153                               itkGetStaticConstMacro(OutputImageDimension)>));
00154 
00155 // Cannot get this to work with gcc compiler
00156 #if 0
00157 
00158   itkConceptMacro(KernelDimensionCheck,
00159       (Concept::SameDimension<itkGetStaticConstMacro(KernelDimension),
00160                               itkGetStaticConstMacro(InputImageDimension)>));
00161 #endif
00162 
00164   void SetKernel( const KernelType& kernel );
00165 
00167   itkGetConstReferenceMacro(Kernel, KernelType);
00168 
00171   itkSetMacro(DilateValue, InputPixelType);
00172 
00175   itkGetMacro(DilateValue, InputPixelType);
00176 
00181   itkSetMacro(BackgroundValue, OutputPixelType);
00182 
00187   itkGetMacro(BackgroundValue, OutputPixelType);
00188   
00189 protected:
00190   FastIncrementalBinaryDilateImageFilter();
00191   virtual ~FastIncrementalBinaryDilateImageFilter(){}
00192   void PrintSelf(std::ostream& os, Indent indent) const;
00193 
00197   void AnalyzeKernel();
00198 
00202   void GenerateData();
00203 
00212   void GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
00213   
00214 private:
00215   FastIncrementalBinaryDilateImageFilter(const Self&); //purposely not implemented
00216   void operator=(const Self&); //purposely not implemented
00217 
00220   InputSizeType m_Radius;
00221 
00223   KernelType m_Kernel;
00224 
00226   InputPixelType m_DilateValue;
00227 
00229   OutputPixelType m_BackgroundValue;
00230   
00231   // type definition of container of neighbourhood index
00232   typedef std::vector< unsigned int > NeighborIndexContainer;
00233 
00234   // type definition of container of container of neighbourhood index
00235   typedef std::vector<NeighborIndexContainer> NeighborIndexContainerContainer;
00236 
00237   // Difference sets definition
00238   NeighborIndexContainerContainer m_KernelDifferenceSets;
00239 
00240   // For each Connected Component ( CC ) of structuring element we
00241   // store the position of one element, arbitrary chosen, which
00242   // belongs to the CC
00243   std::vector< OffsetType > m_KernelCCVectors;
00244 
00245   // vector of index of kernel elements which are ON
00246   std::vector<unsigned int> m_KernelOnElements;
00247 
00248   // Structure for border encoding of input binarized image
00249   struct BorderCell
00250   {
00251     IndexType index;
00252     unsigned int code;
00253   };
00254 
00255   // typedef of container of border cells
00256   typedef std::vector< BorderCell > BorderCellContainer;
00257 };
00258 
00259 } // end namespace itk
00260 
00261 #ifndef ITK_MANUAL_INSTANTIATION
00262 #include "itkFastIncrementalBinaryDilateImageFilter.txx"
00263 #endif
00264 
00265 #endif

Generated at Tue Aug 30 16:43:43 2005 for ITK by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2000