00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkFastIncrementalBinaryDilateImageFilter_h
00018 #define __itkFastIncrementalBinaryDilateImageFilter_h
00019
00020 #include <vector>
00021 #include <queue>
00022 #include "itkImageToImageFilter.h"
00023 #include "itkImage.h"
00024 #include "itkNumericTraits.h"
00025 #include "itkNeighborhoodIterator.h"
00026 #include "itkConstNeighborhoodIterator.h"
00027 #include "itkNeighborhood.h"
00028 #include "itkImageBoundaryCondition.h"
00029 #include "itkImageRegionIterator.h"
00030 #include "itkConceptChecking.h"
00031
00032 namespace itk
00033 {
00102 template <class TInputImage, class TOutputImage, class TKernel>
00103 class ITK_EXPORT FastIncrementalBinaryDilateImageFilter :
00104 public ImageToImageFilter< TInputImage, TOutputImage >
00105 {
00106 public:
00108 itkStaticConstMacro(InputImageDimension, unsigned int,
00109 TInputImage::ImageDimension);
00110 itkStaticConstMacro(OutputImageDimension, unsigned int,
00111 TOutputImage::ImageDimension);
00112
00114 itkStaticConstMacro(KernelDimension, unsigned int,
00115 TKernel::NeighborhoodDimension);
00116
00118 typedef TInputImage InputImageType;
00119 typedef TOutputImage OutputImageType;
00120
00122 typedef FastIncrementalBinaryDilateImageFilter Self;
00123 typedef ImageToImageFilter< InputImageType, OutputImageType> Superclass;
00124 typedef SmartPointer<Self> Pointer;
00125 typedef SmartPointer<const Self> ConstPointer;
00126
00128 itkNewMacro(Self);
00129
00131 itkTypeMacro(FastIncrementalBinaryDilateImageFilter, ImageToImageFilter);
00132
00134 typedef TKernel KernelType;
00135
00137 typedef typename KernelType::ConstIterator KernelIteratorType ;
00138
00140 typedef typename InputImageType::PixelType InputPixelType;
00141 typedef typename OutputImageType::PixelType OutputPixelType;
00142 typedef typename NumericTraits<InputPixelType>::RealType InputRealType;
00143 typedef typename InputImageType::OffsetType OffsetType;
00144 typedef typename InputImageType::IndexType IndexType;
00145
00146 typedef typename InputImageType::RegionType InputImageRegionType;
00147 typedef typename OutputImageType::RegionType OutputImageRegionType;
00148 typedef typename InputImageType::SizeType InputSizeType;
00149
00151 itkConceptMacro(ImageDimensionCheck,
00152 (Concept::SameDimension<itkGetStaticConstMacro(InputImageDimension),
00153 itkGetStaticConstMacro(OutputImageDimension)>));
00154
00155
00156 #if 0
00157
00158 itkConceptMacro(KernelDimensionCheck,
00159 (Concept::SameDimension<itkGetStaticConstMacro(KernelDimension),
00160 itkGetStaticConstMacro(InputImageDimension)>));
00161 #endif
00162
00164 void SetKernel( const KernelType& kernel );
00165
00167 itkGetConstReferenceMacro(Kernel, KernelType);
00168
00171 itkSetMacro(DilateValue, InputPixelType);
00172
00175 itkGetMacro(DilateValue, InputPixelType);
00176
00181 itkSetMacro(BackgroundValue, OutputPixelType);
00182
00187 itkGetMacro(BackgroundValue, OutputPixelType);
00188
00189 protected:
00190 FastIncrementalBinaryDilateImageFilter();
00191 virtual ~FastIncrementalBinaryDilateImageFilter(){}
00192 void PrintSelf(std::ostream& os, Indent indent) const;
00193
00197 void AnalyzeKernel();
00198
00202 void GenerateData();
00203
00212 void GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
00213
00214 private:
00215 FastIncrementalBinaryDilateImageFilter(const Self&);
00216 void operator=(const Self&);
00217
00220 InputSizeType m_Radius;
00221
00223 KernelType m_Kernel;
00224
00226 InputPixelType m_DilateValue;
00227
00229 OutputPixelType m_BackgroundValue;
00230
00231
00232 typedef std::vector< unsigned int > NeighborIndexContainer;
00233
00234
00235 typedef std::vector<NeighborIndexContainer> NeighborIndexContainerContainer;
00236
00237
00238 NeighborIndexContainerContainer m_KernelDifferenceSets;
00239
00240
00241
00242
00243 std::vector< OffsetType > m_KernelCCVectors;
00244
00245
00246 std::vector<unsigned int> m_KernelOnElements;
00247
00248
00249 struct BorderCell
00250 {
00251 IndexType index;
00252 unsigned int code;
00253 };
00254
00255
00256 typedef std::vector< BorderCell > BorderCellContainer;
00257 };
00258
00259 }
00260
00261 #ifndef ITK_MANUAL_INSTANTIATION
00262 #include "itkFastIncrementalBinaryDilateImageFilter.txx"
00263 #endif
00264
00265 #endif