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
00021
00022
00023 #include "itkConfigure.h"
00024
00025 #ifdef ITK_USE_CONSOLIDATED_MORPHOLOGY
00026 #include "itkOptMorphologyImageFilter.h"
00027 #else
00028
00029
00030 #include "itkImageToImageFilter.h"
00031 #include "itkNeighborhoodIterator.h"
00032 #include "itkConstNeighborhoodIterator.h"
00033 #include "itkNeighborhood.h"
00034 #include "itkConstSliceIterator.h"
00035 #include "itkImageBoundaryCondition.h"
00036 #include "itkConstantBoundaryCondition.h"
00037 #include "itkImageRegionIterator.h"
00038
00039 namespace itk {
00040
00081 template<class TInputImage, class TOutputImage, class TKernel>
00082 class ITK_EXPORT MorphologyImageFilter :
00083 public ImageToImageFilter<TInputImage, TOutputImage>
00084 {
00085 public:
00087 typedef MorphologyImageFilter Self;
00088 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00089 typedef SmartPointer<Self> Pointer;
00090 typedef SmartPointer<const Self> ConstPointer;
00091
00093 itkTypeMacro(MorphologyImageFilter, ImageToImageFilter);
00094
00096 typedef TInputImage InputImageType;
00097 typedef TOutputImage OutputImageType;
00098 typedef typename TInputImage::RegionType RegionType;
00099 typedef typename TInputImage::SizeType SizeType;
00100 typedef typename TInputImage::IndexType IndexType;
00101 typedef typename TInputImage::PixelType PixelType;
00102 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00103
00105 itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00106
00108 typedef ImageBoundaryCondition<InputImageType> * ImageBoundaryConditionPointerType;
00109 typedef ImageBoundaryCondition<InputImageType> const * ImageBoundaryConditionConstPointerType;
00110 typedef ConstantBoundaryCondition<InputImageType> DefaultBoundaryConditionType;
00111
00112
00114 typedef ConstNeighborhoodIterator<TInputImage>
00115 NeighborhoodIteratorType;
00116
00118 typedef TKernel KernelType;
00119
00121 typedef typename KernelType::ConstIterator KernelIteratorType;
00122
00124 typedef typename KernelType::SizeType RadiusType;
00125
00127 itkSetMacro(Kernel, KernelType);
00128
00130 itkGetConstReferenceMacro(Kernel, KernelType);
00131
00137 void GenerateInputRequestedRegion();
00138
00144 void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00145 { m_BoundaryCondition = i; }
00146
00148 void ResetBoundaryCondition()
00149 { m_BoundaryCondition = &m_DefaultBoundaryCondition; }
00150
00152 itkGetMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
00153
00154 protected:
00155 MorphologyImageFilter();
00156 ~MorphologyImageFilter() {};
00157 void PrintSelf(std::ostream& os, Indent indent) const;
00158
00160 void ThreadedGenerateData (const OutputImageRegionType&
00161 outputRegionForThread,
00162 int threadId);
00163
00166 virtual PixelType Evaluate(const NeighborhoodIteratorType &nit,
00167 const KernelIteratorType kernelBegin,
00168 const KernelIteratorType kernelEnd)=0;
00169
00170 private:
00171 MorphologyImageFilter(const Self&);
00172 void operator=(const Self&);
00173
00175 KernelType m_Kernel;
00176
00179 ImageBoundaryConditionPointerType m_BoundaryCondition;
00180
00182 DefaultBoundaryConditionType m_DefaultBoundaryCondition;
00183
00184 };
00185
00186 }
00187
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkMorphologyImageFilter.txx"
00190 #endif
00191
00192 #endif
00193
00194 #endif
00195