Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOptGrayscaleErodeImageFilter_h
00018 #define __itkOptGrayscaleErodeImageFilter_h
00019
00020 #include "itkKernelImageFilter.h"
00021 #include "itkMovingHistogramErodeImageFilter.h"
00022 #include "itkBasicErodeImageFilter.h"
00023 #include "itkAnchorErodeImageFilter.h"
00024 #include "itkVanHerkGilWermanErodeImageFilter.h"
00025 #include "itkCastImageFilter.h"
00026 #include "itkConstantBoundaryCondition.h"
00027 #include "itkFlatStructuringElement.h"
00028 #include "itkNeighborhood.h"
00029
00030 namespace itk {
00031
00047 template<class TInputImage, class TOutputImage, class TKernel>
00048 class ITK_EXPORT GrayscaleErodeImageFilter :
00049 public KernelImageFilter<TInputImage, TOutputImage, TKernel>
00050 {
00051 public:
00053 typedef GrayscaleErodeImageFilter Self;
00054 typedef KernelImageFilter<TInputImage,TOutputImage, TKernel> Superclass;
00055 typedef SmartPointer<Self> Pointer;
00056 typedef SmartPointer<const Self> ConstPointer;
00057
00059 itkNewMacro(Self);
00060
00062 itkTypeMacro(GrayscaleErodeImageFilter,
00063 KernelImageFilter);
00064
00066 itkStaticConstMacro(ImageDimension, unsigned int,
00067 TInputImage::ImageDimension);
00068
00070 typedef TInputImage InputImageType;
00071 typedef TOutputImage OutputImageType;
00072 typedef typename TInputImage::RegionType RegionType;
00073 typedef typename TInputImage::SizeType SizeType;
00074 typedef typename TInputImage::IndexType IndexType;
00075 typedef typename TInputImage::PixelType PixelType;
00076 typedef typename TInputImage::OffsetType OffsetType;
00077 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00078
00079 typedef MovingHistogramErodeImageFilter< TInputImage, TOutputImage, TKernel >
00080 HistogramFilterType;
00081 typedef BasicErodeImageFilter< TInputImage, TOutputImage, TKernel >
00082 BasicFilterType;
00083
00084 typedef FlatStructuringElement< itkGetStaticConstMacro(ImageDimension) > FlatKernelType;
00085
00086 typedef AnchorErodeImageFilter< TInputImage, FlatKernelType > AnchorFilterType;
00087 typedef VanHerkGilWermanErodeImageFilter< TInputImage, FlatKernelType >
00088 VHGWFilterType;
00089 typedef CastImageFilter< TInputImage, TOutputImage > CastFilterType;
00090
00092 typedef ImageBoundaryCondition<InputImageType> *ImageBoundaryConditionPointerType;
00093 typedef ImageBoundaryCondition<InputImageType> const *ImageBoundaryConditionConstPointerType;
00094 typedef ConstantBoundaryCondition<InputImageType> DefaultBoundaryConditionType;
00095
00096
00098 typedef TKernel KernelType;
00099
00100
00101
00103 void SetKernel( const KernelType& kernel );
00104
00106 void SetBoundary( const PixelType value );
00107 itkGetConstMacro(Boundary, PixelType);
00109
00111 void SetAlgorithm(int algo );
00112 itkGetConstMacro(Algorithm, int);
00114
00116 virtual void Modified() const;
00117
00124 void OverrideBoundaryCondition(const DefaultBoundaryConditionType* i)
00125 {
00126 itkLegacyBodyMacro(GrayscaleErodeImageFilter::OverrideBoundaryCondition, 2.8);
00127 SetBoundary( i->GetConstant() );
00128 }
00130
00134 const DefaultBoundaryConditionType* GetBoundaryCondition()
00135 {
00136 itkLegacyBodyMacro(GrayscaleErodeImageFilter::GetBoundaryCondition, 2.8);
00137 return &m_BoundaryCondition;
00138 }
00140
00144 void ResetBoundaryCondition()
00145 {
00146 itkLegacyBodyMacro(GrayscaleErodeImageFilter::ResetBoundaryCondition, 2.8);
00147 SetBoundary( NumericTraits< PixelType >::NonpositiveMin() );
00148 }
00150
00152 enum {
00153 BASIC = 0,
00154 HISTO = 1,
00155 ANCHOR = 2,
00156 VHGW = 3
00157 } AlgorithmChoice;
00158
00159 void SetNumberOfThreads( int nb );
00160
00161
00162 protected:
00163 GrayscaleErodeImageFilter();
00164 ~GrayscaleErodeImageFilter() {};
00165 void PrintSelf(std::ostream& os, Indent indent) const;
00166
00167 void GenerateData();
00168
00169 private:
00170 GrayscaleErodeImageFilter(const Self&);
00171 void operator=(const Self&);
00172
00173 PixelType m_Boundary;
00174
00175
00176 typename HistogramFilterType::Pointer m_HistogramFilter;
00177 typename BasicFilterType::Pointer m_BasicFilter;
00178 typename AnchorFilterType::Pointer m_AnchorFilter;
00179 typename VHGWFilterType::Pointer m_VHGWFilter;
00180
00181
00182 int m_Algorithm;
00183
00184
00185 DefaultBoundaryConditionType m_BoundaryCondition;
00186
00187 };
00188
00189 }
00190
00191 #ifndef ITK_MANUAL_INSTANTIATION
00192 #include "itkOptGrayscaleErodeImageFilter.txx"
00193 #endif
00194
00195 #endif
00196