ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMorphologicalGradientImageFilter.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 __itkMorphologicalGradientImageFilter_h
00019 #define __itkMorphologicalGradientImageFilter_h
00020 
00021 #include "itkKernelImageFilter.h"
00022 #include "itkMovingHistogramMorphologicalGradientImageFilter.h"
00023 #include "itkBasicDilateImageFilter.h"
00024 #include "itkBasicErodeImageFilter.h"
00025 #include "itkAnchorErodeImageFilter.h"
00026 #include "itkAnchorDilateImageFilter.h"
00027 #include "itkVanHerkGilWermanDilateImageFilter.h"
00028 #include "itkVanHerkGilWermanErodeImageFilter.h"
00029 #include "itkSubtractImageFilter.h"
00030 #include "itkConstantBoundaryCondition.h"
00031 #include "itkNeighborhood.h"
00032 
00033 namespace itk
00034 {
00051 template< class TInputImage, class TOutputImage, class TKernel >
00052 class ITK_EXPORT MorphologicalGradientImageFilter:
00053   public KernelImageFilter< TInputImage, TOutputImage, TKernel >
00054 {
00055 public:
00057   typedef MorphologicalGradientImageFilter                        Self;
00058   typedef KernelImageFilter< TInputImage, TOutputImage, TKernel > Superclass;
00059   typedef SmartPointer< Self >                                    Pointer;
00060   typedef SmartPointer< const Self >                              ConstPointer;
00061 
00063   itkNewMacro(Self);
00064 
00066   itkTypeMacro(MorphologicalGradientImageFilter,
00067                KernelImageFilter);
00068 
00070   itkStaticConstMacro(ImageDimension, unsigned int,
00071                       TInputImage::ImageDimension);
00072 
00074   typedef TInputImage                                InputImageType;
00075   typedef TOutputImage                               OutputImageType;
00076   typedef typename TInputImage::RegionType           RegionType;
00077   typedef typename TInputImage::SizeType             SizeType;
00078   typedef typename TInputImage::IndexType            IndexType;
00079   typedef typename TInputImage::PixelType            PixelType;
00080   typedef typename TInputImage::OffsetType           OffsetType;
00081   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00082 
00083   typedef FlatStructuringElement< itkGetStaticConstMacro(ImageDimension) >
00084   FlatKernelType;
00085   typedef MovingHistogramMorphologicalGradientImageFilter< TInputImage, TOutputImage, TKernel >
00086   HistogramFilterType;
00087   typedef BasicDilateImageFilter< TInputImage, TInputImage, TKernel >
00088   BasicDilateFilterType;
00089   typedef BasicErodeImageFilter< TInputImage, TInputImage, TKernel >
00090   BasicErodeFilterType;
00091   typedef AnchorDilateImageFilter< TInputImage, FlatKernelType >
00092   AnchorDilateFilterType;
00093   typedef AnchorErodeImageFilter< TInputImage, FlatKernelType > AnchorErodeFilterType;
00094   typedef VanHerkGilWermanDilateImageFilter< TInputImage, FlatKernelType >
00095   VHGWDilateFilterType;
00096   typedef VanHerkGilWermanErodeImageFilter< TInputImage, FlatKernelType >
00097   VHGWErodeFilterType;
00098   typedef SubtractImageFilter< TInputImage, TInputImage, TOutputImage >
00099   SubtractFilterType;
00100 
00102   typedef TKernel KernelType;
00103 //   typedef typename KernelType::Superclass KernelSuperClass;
00104 //   typedef Neighborhood< typename KernelType::PixelType, ImageDimension >
00105 // KernelSuperClass;
00106 
00108   void SetKernel(const KernelType & kernel);
00109 
00111   void SetAlgorithm(int algo);
00112 
00113   itkGetConstMacro(Algorithm, int);
00114 
00117   virtual void Modified() const;
00118 
00120   enum {
00121     BASIC = 0,
00122     HISTO = 1,
00123     ANCHOR = 2,
00124     VHGW = 3
00125     } AlgorithmChoice;
00126 protected:
00127   MorphologicalGradientImageFilter();
00128   ~MorphologicalGradientImageFilter() {}
00129   void PrintSelf(std::ostream & os, Indent indent) const;
00131 
00132   void GenerateData();
00133 
00134 private:
00135   MorphologicalGradientImageFilter(const Self &); //purposely not implemented
00136   void operator=(const Self &);                   //purposely not implemented
00137 
00138   // the filters used internally
00139   typename HistogramFilterType::Pointer m_HistogramFilter;
00140 
00141   typename BasicDilateFilterType::Pointer m_BasicDilateFilter;
00142 
00143   typename BasicErodeFilterType::Pointer m_BasicErodeFilter;
00144 
00145   typename AnchorDilateFilterType::Pointer m_AnchorDilateFilter;
00146 
00147   typename AnchorErodeFilterType::Pointer m_AnchorErodeFilter;
00148 
00149   typename VHGWDilateFilterType::Pointer m_VanHerkGilWermanDilateFilter;
00150 
00151   typename VHGWErodeFilterType::Pointer m_VanHerkGilWermanErodeFilter;
00152 
00153   // and the name of the filter
00154   int m_Algorithm;
00155 }; // end of class
00156 } // end namespace itk
00157 
00158 #ifndef ITK_MANUAL_INSTANTIATION
00159 #include "itkMorphologicalGradientImageFilter.hxx"
00160 #endif
00161 
00162 #endif
00163