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 __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
00094 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00095
00096 typedef ImageBoundaryCondition<InputImageType> *
00097 ImageBoundaryConditionPointerType;
00098 typedef ImageBoundaryCondition<InputImageType> const *
00099 ImageBoundaryConditionConstPointerType;
00100 typedef ConstantBoundaryCondition<InputImageType>
00101 DefaultBoundaryConditionType;
00102
00104 itkStaticConstMacro(ImageDimension, unsigned int,
00105 TInputImage::ImageDimension);
00106 itkStaticConstMacro(OutputImageDimension, unsigned int,
00107 TOutputImage::ImageDimension );
00108 itkStaticConstMacro(KernelDimension, unsigned int,
00109 TKernel::NeighborhoodDimension);
00111
00113 typedef ConstNeighborhoodIterator<TInputImage>
00114 InputNeighborhoodIteratorType;
00115 typedef NeighborhoodIterator<TOutputImage>
00116 OutputNeighborhoodIteratorType;
00117
00119 typedef TKernel KernelType;
00120
00122 typedef typename KernelType::ConstIterator KernelIteratorType;
00123
00125 typedef typename KernelType::SizeType RadiusType;
00126
00128 itkSetMacro(Kernel, KernelType);
00129
00131 itkGetConstReferenceMacro(Kernel, KernelType);
00132
00134 itkGetConstMacro(ObjectValue, PixelType);
00135
00137 itkSetMacro(ObjectValue, PixelType);
00138
00144 void GenerateInputRequestedRegion();
00145
00152 void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00153 { m_BoundaryCondition = i; }
00154
00156 void ResetBoundaryCondition()
00157 { m_BoundaryCondition = &m_DefaultBoundaryCondition; }
00158
00160 itkGetConstMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
00161
00166 itkSetMacro(UseBoundaryCondition, bool);
00167
00172 itkGetConstMacro(UseBoundaryCondition, bool);
00173
00174 #ifdef ITK_USE_CONCEPT_CHECKING
00175
00176 itkConceptMacro(SameDimensionCheck1,
00177 (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00178 itkConceptMacro(SameDimensionCheck2,
00179 (Concept::SameDimension<ImageDimension, KernelDimension>));
00180 itkConceptMacro(OutputInputEqualityComparableCheck,
00181 (Concept::EqualityComparable<typename TOutputImage::PixelType,
00182 PixelType>));
00183 itkConceptMacro(InputConvertibleToOutputCheck,
00184 (Concept::Convertible<PixelType, typename TOutputImage::PixelType>));
00185 itkConceptMacro(IntConvertibleToOutputCheck,
00186 (Concept::Convertible<int, typename TOutputImage::PixelType>));
00187 itkConceptMacro(InputEqualityComparable,
00188 (Concept::EqualityComparable<PixelType>));
00189 itkConceptMacro(InputOStreamWritableCheck,
00190 (Concept::OStreamWritable<PixelType>));
00191
00193 #endif
00194
00195 protected:
00196 ObjectMorphologyImageFilter();
00197 ~ObjectMorphologyImageFilter() {};
00198 void PrintSelf(std::ostream& os, Indent indent) const;
00199
00201 void ThreadedGenerateData (const OutputImageRegionType&
00202 outputRegionForThread,
00203 int threadId);
00204
00207 virtual void Evaluate(OutputNeighborhoodIteratorType &nit,
00208 const KernelType &kernel)=0;
00209
00213 bool IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType &nit);
00214
00217 ImageBoundaryConditionPointerType m_BoundaryCondition;
00218
00220 DefaultBoundaryConditionType m_DefaultBoundaryCondition;
00221
00223 bool m_UseBoundaryCondition;
00224
00226 KernelType m_Kernel;
00227
00229 PixelType m_ObjectValue;
00230
00231 void BeforeThreadedGenerateData();
00232
00233 private:
00234 ObjectMorphologyImageFilter(const Self&);
00235 void operator=(const Self&);
00236
00237
00238
00239 };
00240
00241 }
00242
00243 #ifndef ITK_MANUAL_INSTANTIATION
00244 #include "itkObjectMorphologyImageFilter.txx"
00245 #endif
00246
00247 #endif
00248