00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkZeroCrossingBasedEdgeDetectionImageFilter_h
00018 #define __itkZeroCrossingBasedEdgeDetectionImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkImage.h"
00022
00023
00024 namespace itk
00025 {
00026
00068 template<class TInputImage, class TOutputImage>
00069 class ITK_EXPORT ZeroCrossingBasedEdgeDetectionImageFilter
00070 : public ImageToImageFilter<TInputImage, TOutputImage>
00071 {
00072 public:
00074 typedef ZeroCrossingBasedEdgeDetectionImageFilter Self;
00075 typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;
00076
00078 typedef TInputImage InputImageType;
00079 typedef TOutputImage OutputImageType;
00080
00082 typedef SmartPointer<Self> Pointer;
00083 typedef SmartPointer<const Self> ConstPointer;
00084
00086 typedef typename TInputImage::PixelType InputImagePixelType;
00087 typedef typename TOutputImage::PixelType OutputImagePixelType;
00088
00090 itkNewMacro(Self);
00091
00093 typedef typename TOutputImage::RegionType OutputImageRegionType;
00094
00096 itkTypeMacro(ZeroCrossingBasedEdgeDetectionImageFilter, ImageToImageFilter);
00097
00099 itkStaticConstMacro(ImageDimension, unsigned int,
00100 TInputImage::ImageDimension );
00101
00103 itkSetVectorMacro(Variance, double, ImageDimension);
00104 itkGetVectorMacro(Variance, const double, ImageDimension);
00105 itkSetVectorMacro(MaximumError, double, ImageDimension);
00106 itkGetVectorMacro(MaximumError, const double, ImageDimension);
00107
00109 itkGetMacro(BackgroundValue, OutputImagePixelType);
00110 itkSetMacro(BackgroundValue, OutputImagePixelType);
00111 itkGetMacro(ForegroundValue, OutputImagePixelType);
00112 itkSetMacro(ForegroundValue, OutputImagePixelType);
00113
00115 void SetVariance(const double v)
00116 {
00117 double vArray[ImageDimension];
00118 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = v; }
00119 this->SetVariance(vArray);
00120 }
00121
00123 void SetMaximumError(const double v)
00124 {
00125 double vArray[ImageDimension];
00126 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = v; }
00127 this->SetMaximumError(vArray);
00128 }
00129
00130
00131
00132
00133 protected:
00134 ZeroCrossingBasedEdgeDetectionImageFilter()
00135 {
00136 this->SetVariance(1.0f);
00137 this->SetMaximumError(0.01f);
00138 m_BackgroundValue = NumericTraits<OutputImagePixelType>::Zero;
00139 m_ForegroundValue = NumericTraits<OutputImagePixelType>::One;
00140 }
00141 ~ZeroCrossingBasedEdgeDetectionImageFilter(){}
00142 ZeroCrossingBasedEdgeDetectionImageFilter(const Self&) {}
00143 void PrintSelf(std::ostream& os, Indent indent) const;
00144
00151 void GenerateData();
00152
00153 private:
00155 double m_Variance[ImageDimension];
00156
00159 double m_MaximumError[ImageDimension];
00160
00161 OutputImagePixelType m_BackgroundValue;
00162 OutputImagePixelType m_ForegroundValue;
00163 };
00164
00165 }
00166
00167 #ifndef ITK_MANUAL_INSTANTIATION
00168 #include "itkZeroCrossingBasedEdgeDetectionImageFilter.txx"
00169 #endif
00170
00171 #endif
00172