00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMorphologyImageFilter_h
00018 #define __itkMorphologyImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkNeighborhoodIterator.h"
00022 #include "itkConstNeighborhoodIterator.h"
00023 #include "itkNeighborhood.h"
00024 #include "itkConstSliceIterator.h"
00025 #include "itkImageBoundaryCondition.h"
00026 #include "itkConstantBoundaryCondition.h"
00027 #include "itkImageRegionIterator.h"
00028
00029 namespace itk {
00030
00071 template<class TInputImage, class TOutputImage, class TKernel>
00072 class ITK_EXPORT MorphologyImageFilter :
00073 public ImageToImageFilter<TInputImage, TOutputImage>
00074 {
00075 public:
00077 typedef MorphologyImageFilter Self;
00078 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00079 typedef SmartPointer<Self> Pointer;
00080 typedef SmartPointer<const Self> ConstPointer;
00081
00083 itkTypeMacro(MorphologyImageFilter, ImageToImageFilter);
00084
00086 typedef TInputImage InputImageType;
00087 typedef TOutputImage OutputImageType;
00088 typedef typename TInputImage::RegionType RegionType ;
00089 typedef typename TInputImage::SizeType SizeType ;
00090 typedef typename TInputImage::IndexType IndexType ;
00091 typedef typename TInputImage::PixelType PixelType ;
00092 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00093
00095 itkStaticConstMacro(ImageDimension, unsigned int,
00096 TInputImage::ImageDimension);
00097
00099 typedef ImageBoundaryCondition<InputImageType> *ImageBoundaryConditionPointerType;
00100 typedef ImageBoundaryCondition<InputImageType> const *ImageBoundaryConditionConstPointerType;
00101 typedef ConstantBoundaryCondition<InputImageType> DefaultBoundaryConditionType;
00102
00103
00105 typedef ConstNeighborhoodIterator<TInputImage>
00106 NeighborhoodIteratorType ;
00107
00109 typedef TKernel KernelType;
00110
00112 typedef typename KernelType::ConstIterator KernelIteratorType ;
00113
00115 typedef typename KernelType::SizeType RadiusType ;
00116
00118 itkSetMacro(Kernel, KernelType);
00119
00121 itkGetConstReferenceMacro(Kernel, KernelType);
00122
00128 void GenerateInputRequestedRegion() ;
00129
00135 void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00136 { m_BoundaryCondition = i; }
00137
00139 void ResetBoundaryCondition()
00140 { m_BoundaryCondition = &m_DefaultBoundaryCondition; }
00141
00143 itkGetMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
00144
00145 protected:
00146 MorphologyImageFilter();
00147 ~MorphologyImageFilter() {};
00148 void PrintSelf(std::ostream& os, Indent indent) const;
00149
00151 void ThreadedGenerateData (const OutputImageRegionType&
00152 outputRegionForThread,
00153 int threadId) ;
00154
00157 virtual PixelType Evaluate(const NeighborhoodIteratorType &nit,
00158 const KernelIteratorType kernelBegin,
00159 const KernelIteratorType kernelEnd)=0;
00160
00161 private:
00162 MorphologyImageFilter(const Self&);
00163 void operator=(const Self&);
00164
00166 KernelType m_Kernel ;
00167
00170 ImageBoundaryConditionPointerType m_BoundaryCondition;
00171
00173 DefaultBoundaryConditionType m_DefaultBoundaryCondition;
00174
00175 } ;
00176
00177 }
00178
00179 #ifndef ITK_MANUAL_INSTANTIATION
00180 #include "itkMorphologyImageFilter.txx"
00181 #endif
00182
00183 #endif
00184