00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkAnchorOpenCloseImageFilter_h
00019 #define __itkAnchorOpenCloseImageFilter_h
00020
00021 #include "itkImageToImageFilter.h"
00022 #include "itkProgressReporter.h"
00023 #include "itkAnchorOpenCloseLine.h"
00024 #include "itkAnchorErodeDilateLine.h"
00025 #include "itkBresenhamLine.h"
00026
00027 namespace itk {
00028
00049 template<class TImage, class TKernel,
00050 class LessThan, class GreaterThan, class LessEqual, class GreaterEqual>
00051
00052
00053 class ITK_EXPORT AnchorOpenCloseImageFilter :
00054 public ImageToImageFilter<TImage, TImage>
00055 {
00056 public:
00057
00059 typedef AnchorOpenCloseImageFilter Self;
00060 typedef ImageToImageFilter<TImage, TImage> Superclass;
00061 typedef SmartPointer<Self> Pointer;
00062 typedef SmartPointer<const Self> ConstPointer;
00063
00067 typedef TKernel KernelType;
00068 typedef typename KernelType::LType KernelLType;
00069
00070 typedef TImage InputImageType;
00071 typedef typename InputImageType::Pointer InputImagePointer;
00072 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00073 typedef typename InputImageType::RegionType InputImageRegionType;
00074 typedef typename InputImageType::PixelType InputImagePixelType;
00075
00077 itkStaticConstMacro(InputImageDimension, unsigned int,
00078 TImage::ImageDimension);
00079 itkStaticConstMacro(OutputImageDimension, unsigned int,
00080 TImage::ImageDimension);
00082
00084 itkNewMacro(Self);
00085
00087 itkTypeMacro(AnchorOpenCloseImageFilter,
00088 ImageToImageFilter);
00089
00090 void SetKernel( const KernelType& kernel )
00091 {
00092 m_Kernel=kernel;
00093 m_KernelSet = true;
00094 }
00095
00096 protected:
00097 AnchorOpenCloseImageFilter();
00098 ~AnchorOpenCloseImageFilter() {};
00099 void PrintSelf(std::ostream& os, Indent indent) const;
00100
00102 void ThreadedGenerateData (const InputImageRegionType& outputRegionForThread,
00103 int threadId);
00104
00110 void GenerateInputRequestedRegion();
00111
00112 InputImagePixelType m_Boundary1, m_Boundary2;
00113
00114 private:
00115 AnchorOpenCloseImageFilter(const Self&);
00116 void operator=(const Self&);
00117
00118 TKernel m_Kernel;
00119 bool m_KernelSet;
00120 typedef BresenhamLine<itkGetStaticConstMacro(InputImageDimension)> BresType;
00121 typedef typename BresType::OffsetArray BresOffsetArray;
00122
00123
00124
00125
00126
00127
00128 typedef AnchorOpenCloseLine<InputImagePixelType, LessThan, GreaterEqual, LessEqual> AnchorLineOpenType;
00129
00130 typedef AnchorErodeDilateLine<InputImagePixelType, LessThan, LessEqual> AnchorLineErodeType;
00131
00132
00133 typedef AnchorErodeDilateLine<InputImagePixelType, GreaterThan, GreaterEqual> AnchorLineDilateType;
00134
00135 void DoFaceOpen(InputImageConstPointer input,
00136 InputImagePointer output,
00137 InputImagePixelType border,
00138 KernelLType line,
00139 AnchorLineOpenType &AnchorLineOpen,
00140 const BresOffsetArray LineOffsets,
00141 InputImagePixelType * outbuffer,
00142 const InputImageRegionType AllImage,
00143 const InputImageRegionType face);
00144
00145
00146 };
00147
00148
00149 }
00150
00151
00152 #ifndef ITK_MANUAL_INSTANTIATION
00153 #include "itkAnchorOpenCloseImageFilter.txx"
00154 #endif
00155
00156 #endif
00157