00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkObjectMorphologyImageFilter_h
00018 #define __itkObjectMorphologyImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkNeighborhoodIterator.h"
00022 #include "itkNeighborhood.h"
00023 #include "itkConstSliceIterator.h"
00024 #include "itkConstantBoundaryCondition.h"
00025 #include "itkImageBoundaryCondition.h"
00026 #include "itkImageRegionIterator.h"
00027
00028 namespace itk {
00029
00072 template<class TInputImage, class TOutputImage, class TKernel>
00073 class ITK_EXPORT ObjectMorphologyImageFilter :
00074 public ImageToImageFilter<TInputImage, TOutputImage>
00075 {
00076 public:
00078 typedef ObjectMorphologyImageFilter Self;
00079 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00080 typedef SmartPointer<Self> Pointer;
00081 typedef SmartPointer<const Self> ConstPointer;
00082
00084 itkTypeMacro(ObjectMorphologyImageFilter, ImageToImageFilter);
00085
00087 typedef TInputImage InputImageType;
00088 typedef TOutputImage OutputImageType;
00089 typedef typename TInputImage::RegionType RegionType ;
00090 typedef typename TInputImage::SizeType SizeType ;
00091 typedef typename TInputImage::IndexType IndexType ;
00092 typedef typename TInputImage::PixelType PixelType ;
00093 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00094
00095 typedef ImageBoundaryCondition<InputImageType> *
00096 ImageBoundaryConditionPointerType;
00097 typedef ImageBoundaryCondition<InputImageType> const *
00098 ImageBoundaryConditionConstPointerType;
00099 typedef ConstantBoundaryCondition<InputImageType>
00100 DefaultBoundaryConditionType;
00101
00103 itkStaticConstMacro(ImageDimension, unsigned int,
00104 TInputImage::ImageDimension);
00105
00107 typedef ConstNeighborhoodIterator<TInputImage>
00108 InputNeighborhoodIteratorType ;
00109
00110 typedef NeighborhoodIterator<TOutputImage>
00111 OutputNeighborhoodIteratorType ;
00112
00114 typedef TKernel KernelType;
00115
00117 typedef typename KernelType::ConstIterator KernelIteratorType ;
00118
00120 typedef typename KernelType::SizeType RadiusType ;
00121
00123 itkSetMacro(Kernel, KernelType);
00124
00126 itkGetConstReferenceMacro(Kernel, KernelType);
00127
00129 itkGetMacro(ObjectValue, PixelType);
00130
00132 itkSetMacro(ObjectValue, PixelType);
00133
00139 void GenerateInputRequestedRegion() ;
00140
00147 void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00148 { m_BoundaryCondition = i; }
00149
00151 void ResetBoundaryCondition()
00152 { m_BoundaryCondition = &m_DefaultBoundaryCondition; }
00153
00155 itkGetMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
00156
00161 itkSetMacro(UseBoundaryCondition, bool);
00162
00167 itkGetMacro(UseBoundaryCondition, bool);
00168
00169 protected:
00170 ObjectMorphologyImageFilter();
00171 ~ObjectMorphologyImageFilter() {};
00172 void PrintSelf(std::ostream& os, Indent indent) const;
00173
00175 void ThreadedGenerateData (const OutputImageRegionType&
00176 outputRegionForThread,
00177 int threadId) ;
00178
00181 virtual void Evaluate(OutputNeighborhoodIteratorType &nit,
00182 const KernelType &kernel)=0;
00183
00187 bool IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType &nit);
00188
00191 ImageBoundaryConditionPointerType m_BoundaryCondition;
00192
00194 DefaultBoundaryConditionType m_DefaultBoundaryCondition;
00195
00197 bool m_UseBoundaryCondition;
00198
00200 KernelType m_Kernel ;
00201
00203 PixelType m_ObjectValue;
00204
00205 void BeforeThreadedGenerateData();
00206
00207 private:
00208 ObjectMorphologyImageFilter(const Self&);
00209 void operator=(const Self&);
00210
00211
00212
00213 } ;
00214
00215 }
00216
00217 #ifndef ITK_MANUAL_INSTANTIATION
00218 #include "itkObjectMorphologyImageFilter.txx"
00219 #endif
00220
00221 #endif