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

itkOptGrayscaleErodeImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkOptGrayscaleErodeImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-09-30 18:07:03 $
00007   Version:   $Revision: 1.5 $
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 __itkOptGrayscaleErodeImageFilter_h
00018 #define __itkOptGrayscaleErodeImageFilter_h
00019 
00020 #include "itkKernelImageFilter.h"
00021 #include "itkMovingHistogramErodeImageFilter.h"
00022 #include "itkBasicErodeImageFilter.h"
00023 #include "itkAnchorErodeImageFilter.h"
00024 #include "itkVanHerkGilWermanErodeImageFilter.h"
00025 #include "itkCastImageFilter.h"
00026 #include "itkConstantBoundaryCondition.h"
00027 #include "itkFlatStructuringElement.h"
00028 #include "itkNeighborhood.h"
00029 
00030 namespace itk {
00031 
00047 template<class TInputImage, class TOutputImage, class TKernel>
00048 class ITK_EXPORT GrayscaleErodeImageFilter : 
00049     public KernelImageFilter<TInputImage, TOutputImage, TKernel>
00050 {
00051 public:
00053   typedef GrayscaleErodeImageFilter                             Self;
00054   typedef KernelImageFilter<TInputImage,TOutputImage, TKernel>  Superclass;
00055   typedef SmartPointer<Self>                                    Pointer;
00056   typedef SmartPointer<const Self>                              ConstPointer;
00057 
00059   itkNewMacro(Self);  
00060 
00062   itkTypeMacro(GrayscaleErodeImageFilter, 
00063                KernelImageFilter);
00064 
00066   itkStaticConstMacro(ImageDimension, unsigned int,
00067                       TInputImage::ImageDimension);
00068 
00070   typedef TInputImage                                           InputImageType;
00071   typedef TOutputImage                                          OutputImageType;
00072   typedef typename TInputImage::RegionType                      RegionType;
00073   typedef typename TInputImage::SizeType                        SizeType;
00074   typedef typename TInputImage::IndexType                       IndexType;
00075   typedef typename TInputImage::PixelType                       PixelType;
00076   typedef typename TInputImage::OffsetType                      OffsetType;
00077   typedef typename Superclass::OutputImageRegionType            OutputImageRegionType;
00078 
00079   typedef MovingHistogramErodeImageFilter< TInputImage, TOutputImage, TKernel > 
00080                                                                 HistogramFilterType;
00081   typedef BasicErodeImageFilter< TInputImage, TOutputImage, TKernel >
00082                                                                 BasicFilterType;
00083 
00084   typedef FlatStructuringElement< itkGetStaticConstMacro(ImageDimension) >              FlatKernelType;
00085 
00086   typedef AnchorErodeImageFilter< TInputImage, FlatKernelType > AnchorFilterType;
00087   typedef VanHerkGilWermanErodeImageFilter< TInputImage, FlatKernelType > 
00088                                                                 VHGWFilterType;
00089   typedef CastImageFilter< TInputImage, TOutputImage >          CastFilterType;
00090   
00092   typedef ImageBoundaryCondition<InputImageType> *ImageBoundaryConditionPointerType;
00093   typedef ImageBoundaryCondition<InputImageType> const *ImageBoundaryConditionConstPointerType;
00094   typedef ConstantBoundaryCondition<InputImageType> DefaultBoundaryConditionType;
00095 
00096 
00098   typedef TKernel KernelType;
00099 //   typedef typename KernelType::Superclass KernelSuperClass;
00100 //   typedef Neighborhood< typename KernelType::PixelType, ImageDimension > KernelSuperClass;
00101 
00103   void SetKernel( const KernelType& kernel );
00104 
00106   void SetBoundary( const PixelType value );
00107   itkGetMacro(Boundary, PixelType);
00109 
00111   void SetAlgorithm(int algo );
00112   itkGetMacro(Algorithm, int);
00114 
00116   virtual void Modified() const;
00117 
00124   void OverrideBoundaryCondition(const DefaultBoundaryConditionType* i)
00125     {
00126     itkLegacyBodyMacro(GrayscaleErodeImageFilter::OverrideBoundaryCondition, 2.8);
00127     SetBoundary( i->GetConstant() );
00128     }
00130 
00134   const DefaultBoundaryConditionType* GetBoundaryCondition()
00135     {
00136     itkLegacyBodyMacro(GrayscaleErodeImageFilter::GetBoundaryCondition, 2.8);
00137     return &m_BoundaryCondition;
00138     }
00140 
00144   void ResetBoundaryCondition()
00145     {
00146     itkLegacyBodyMacro(GrayscaleErodeImageFilter::ResetBoundaryCondition, 2.8);
00147     SetBoundary( NumericTraits< PixelType >::NonpositiveMin() );
00148     }
00150 
00152   enum {
00153     BASIC = 0,
00154     HISTO = 1,
00155     ANCHOR = 2,
00156     VHGW = 3
00157   } AlgorithmChoice;
00158 
00159   void SetNumberOfThreads( int nb );
00160 
00161 
00162 protected:
00163   GrayscaleErodeImageFilter();
00164   ~GrayscaleErodeImageFilter() {};
00165   void PrintSelf(std::ostream& os, Indent indent) const;
00166   
00167   void GenerateData();
00168 
00169 private:
00170   GrayscaleErodeImageFilter(const Self&); //purposely not implemented
00171   void operator=(const Self&); //purposely not implemented
00172 
00173   PixelType m_Boundary;
00174 
00175   // the filters used internally
00176   typename HistogramFilterType::Pointer m_HistogramFilter;
00177   typename BasicFilterType::Pointer     m_BasicFilter;
00178   typename AnchorFilterType::Pointer    m_AnchorFilter;
00179   typename VHGWFilterType::Pointer      m_VHGWFilter;
00180 
00181   // and the name of the filter
00182   int m_Algorithm;
00183 
00184   // the boundary condition need to be stored here
00185   DefaultBoundaryConditionType m_BoundaryCondition;
00186   
00187 }; // end of class
00188 
00189 } // end namespace itk
00190   
00191 #ifndef ITK_MANUAL_INSTANTIATION
00192 #include "itkOptGrayscaleErodeImageFilter.txx"
00193 #endif
00194 
00195 #endif
00196 

Generated at Sat Feb 28 13:11:26 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000