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

itkOptGrayscaleDilateImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkOptGrayscaleDilateImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-23 03:43:42 $
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 __itkOptGrayscaleDilateImageFilter_h
00018 #define __itkOptGrayscaleDilateImageFilter_h
00019 
00020 #include "itkKernelImageFilter.h"
00021 #include "itkMovingHistogramDilateImageFilter.h"
00022 #include "itkBasicDilateImageFilter.h"
00023 #include "itkAnchorDilateImageFilter.h"
00024 #include "itkVanHerkGilWermanDilateImageFilter.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 GrayscaleDilateImageFilter : 
00049     public KernelImageFilter<TInputImage, TOutputImage, TKernel>
00050 {
00051 public:
00053   typedef GrayscaleDilateImageFilter                            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(GrayscaleDilateImageFilter, 
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 MovingHistogramDilateImageFilter< TInputImage, TOutputImage, TKernel >
00080                                                                 HistogramFilterType;
00081   typedef BasicDilateImageFilter< TInputImage, TOutputImage, TKernel >
00082                                                                 BasicFilterType;
00083 
00084   typedef FlatStructuringElement< itkGetStaticConstMacro(ImageDimension) >              FlatKernelType;
00085 
00086   typedef AnchorDilateImageFilter< TInputImage, FlatKernelType > 
00087                                                                 AnchorFilterType;
00088   typedef VanHerkGilWermanDilateImageFilter< TInputImage, FlatKernelType >
00089                                                                 VHGWFilterType;
00090   typedef CastImageFilter< TInputImage, TOutputImage >          CastFilterType;
00091   
00093   typedef ImageBoundaryCondition<InputImageType> *ImageBoundaryConditionPointerType;
00094   typedef ImageBoundaryCondition<InputImageType> const *ImageBoundaryConditionConstPointerType;
00095   typedef ConstantBoundaryCondition<InputImageType> DefaultBoundaryConditionType;
00096 
00097 
00099   typedef TKernel KernelType;
00100 //   typedef typename KernelType::Superclass KernelSuperClass;
00101 //   typedef Neighborhood< typename KernelType::PixelType, ImageDimension > KernelSuperClass;
00102 
00104   void SetKernel( const KernelType& kernel );
00105 
00107   void SetBoundary( const PixelType value );
00108   itkGetConstMacro(Boundary, PixelType);
00110 
00112   void SetAlgorithm(int algo );
00113   itkGetConstMacro(Algorithm, int);
00115 
00117   virtual void Modified() const;
00118 
00125   void OverrideBoundaryCondition(const DefaultBoundaryConditionType* i)
00126     {
00127     itkLegacyBodyMacro(GrayscaleDilateImageFilter::OverrideBoundaryCondition, 2.8);
00128     SetBoundary( i->GetConstant() );
00129     }
00131 
00135   const DefaultBoundaryConditionType* GetBoundaryCondition()
00136     {
00137     itkLegacyBodyMacro(GrayscaleDilateImageFilter::GetBoundaryCondition, 2.8);
00138     return &m_BoundaryCondition;
00139     }
00141 
00145   void ResetBoundaryCondition()
00146     {
00147     itkLegacyBodyMacro(GrayscaleDilateImageFilter::ResetBoundaryCondition, 2.8);
00148     SetBoundary( NumericTraits< PixelType >::NonpositiveMin() );
00149     }
00151 
00153   enum {
00154     BASIC = 0,
00155     HISTO = 1,
00156     ANCHOR = 2,
00157     VHGW = 3
00158   } AlgorithmChoice;
00159 
00160   void SetNumberOfThreads( int nb );
00161 
00162 
00163 protected:
00164   GrayscaleDilateImageFilter();
00165   ~GrayscaleDilateImageFilter() {};
00166   void PrintSelf(std::ostream& os, Indent indent) const;
00167   
00168   void GenerateData();
00169 
00170 private:
00171   GrayscaleDilateImageFilter(const Self&); //purposely not implemented
00172   void operator=(const Self&); //purposely not implemented
00173 
00174   PixelType m_Boundary;
00175 
00176   // the filters used internally
00177   typename HistogramFilterType::Pointer m_HistogramFilter;
00178   typename BasicFilterType::Pointer     m_BasicFilter;
00179   typename AnchorFilterType::Pointer    m_AnchorFilter;
00180   typename VHGWFilterType::Pointer      m_VHGWFilter;
00181 
00182   // and the name of the filter
00183   int m_Algorithm;
00184 
00185   // the boundary condition need to be stored here
00186   DefaultBoundaryConditionType m_BoundaryCondition;
00187   
00188 }; // end of class
00189 
00190 } // end namespace itk
00191   
00192 #ifndef ITK_MANUAL_INSTANTIATION
00193 #include "itkOptGrayscaleDilateImageFilter.txx"
00194 #endif
00195 
00196 #endif
00197 

Generated at Tue Sep 15 04:13:52 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000