ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkGrayscaleDilateImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkGrayscaleDilateImageFilter_h
00019 #define __itkGrayscaleDilateImageFilter_h
00020 
00021 #include "itkKernelImageFilter.h"
00022 #include "itkMovingHistogramDilateImageFilter.h"
00023 #include "itkBasicDilateImageFilter.h"
00024 #include "itkAnchorDilateImageFilter.h"
00025 #include "itkVanHerkGilWermanDilateImageFilter.h"
00026 #include "itkCastImageFilter.h"
00027 #include "itkConstantBoundaryCondition.h"
00028 #include "itkNeighborhood.h"
00029 
00030 namespace itk
00031 {
00052 template< class TInputImage, class TOutputImage, class TKernel >
00053 class ITK_EXPORT GrayscaleDilateImageFilter:
00054   public KernelImageFilter< TInputImage, TOutputImage, TKernel >
00055 {
00056 public:
00058   typedef GrayscaleDilateImageFilter                              Self;
00059   typedef KernelImageFilter< TInputImage, TOutputImage, TKernel > Superclass;
00060   typedef SmartPointer< Self >                                    Pointer;
00061   typedef SmartPointer< const Self >                              ConstPointer;
00062 
00064   itkNewMacro(Self);
00065 
00067   itkTypeMacro(GrayscaleDilateImageFilter,
00068                KernelImageFilter);
00069 
00071   itkStaticConstMacro(ImageDimension, unsigned int,
00072                       TInputImage::ImageDimension);
00073 
00075   typedef TInputImage                                InputImageType;
00076   typedef TOutputImage                               OutputImageType;
00077   typedef typename TInputImage::RegionType           RegionType;
00078   typedef typename TInputImage::SizeType             SizeType;
00079   typedef typename TInputImage::IndexType            IndexType;
00080   typedef typename TInputImage::PixelType            PixelType;
00081   typedef typename TInputImage::OffsetType           OffsetType;
00082   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00083 
00084   typedef MovingHistogramDilateImageFilter< TInputImage, TOutputImage, TKernel >
00085   HistogramFilterType;
00086   typedef BasicDilateImageFilter< TInputImage, TOutputImage, TKernel >
00087   BasicFilterType;
00088 
00089   typedef FlatStructuringElement< itkGetStaticConstMacro(ImageDimension) > FlatKernelType;
00090 
00091   typedef AnchorDilateImageFilter< TInputImage, FlatKernelType >           AnchorFilterType;
00092   typedef VanHerkGilWermanDilateImageFilter< TInputImage, FlatKernelType > VHGWFilterType;
00093   typedef CastImageFilter< TInputImage, TOutputImage >                     CastFilterType;
00094 
00096   typedef ImageBoundaryCondition< InputImageType > *      ImageBoundaryConditionPointerType;
00097   typedef ImageBoundaryCondition< InputImageType > const *ImageBoundaryConditionConstPointerType;
00098   typedef ConstantBoundaryCondition< InputImageType >     DefaultBoundaryConditionType;
00099 
00101   typedef TKernel KernelType;
00102 //   typedef typename KernelType::Superclass KernelSuperClass;
00103 //   typedef Neighborhood< typename KernelType::PixelType, ImageDimension >
00104 // KernelSuperClass;
00105 
00107   void SetKernel(const KernelType & kernel);
00108 
00110   void SetBoundary(const PixelType value);
00111 
00112   itkGetConstMacro(Boundary, PixelType);
00113 
00115   void SetAlgorithm(int algo);
00116 
00117   itkGetConstMacro(Algorithm, int);
00118 
00120   virtual void Modified() const;
00121 
00123   enum {
00124     BASIC = 0,
00125     HISTO = 1,
00126     ANCHOR = 2,
00127     VHGW = 3
00128     } AlgorithmChoice;
00129 
00130   void SetNumberOfThreads(ThreadIdType nb);
00131 
00132 protected:
00133   GrayscaleDilateImageFilter();
00134   ~GrayscaleDilateImageFilter() {}
00135   void PrintSelf(std::ostream & os, Indent indent) const;
00136 
00137   void GenerateData();
00138 
00139 private:
00140   GrayscaleDilateImageFilter(const Self &); //purposely not implemented
00141   void operator=(const Self &);             //purposely not implemented
00142 
00143   PixelType m_Boundary;
00144 
00145   // the filters used internally
00146   typename HistogramFilterType::Pointer m_HistogramFilter;
00147 
00148   typename BasicFilterType::Pointer m_BasicFilter;
00149 
00150   typename AnchorFilterType::Pointer m_AnchorFilter;
00151 
00152   typename VHGWFilterType::Pointer m_VHGWFilter;
00153 
00154   // and the name of the filter
00155   int m_Algorithm;
00156 
00157   // the boundary condition need to be stored here
00158   DefaultBoundaryConditionType m_BoundaryCondition;
00159 }; // end of class
00160 } // end namespace itk
00161 
00162 #ifndef ITK_MANUAL_INSTANTIATION
00163 #include "itkGrayscaleDilateImageFilter.hxx"
00164 #endif
00165 
00166 #endif
00167