00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkAnchorErodeDilateLine_h
00019 #define __itkAnchorErodeDilateLine_h
00020
00021 #include "itkAnchorHistogram.h"
00022 #include "itkIndent.h"
00023 namespace itk {
00024
00035 template<class TInputPix, class TFunction1, class TFunction2>
00036 class ITK_EXPORT AnchorErodeDilateLine
00037 {
00038 public:
00039
00041 typedef TInputPix InputImagePixelType;
00042
00043 void DoLine(InputImagePixelType * buffer, InputImagePixelType * inbuffer,
00044 unsigned bufflength);
00045
00046 void SetSize(unsigned int size)
00047 {
00048 m_Size = size;
00049 }
00050
00051 void PrintSelf(std::ostream &os, Indent indent) const;
00052 AnchorErodeDilateLine();
00053 ~AnchorErodeDilateLine()
00054 {
00055 delete m_Histo;
00056 }
00057
00058
00059 private:
00060 unsigned int m_Size;
00061 TFunction1 m_TF1;
00062 TFunction2 m_TF2;
00063
00064 bool m_UseVec;
00065
00066 typedef MorphologyHistogram<InputImagePixelType> Histogram;
00067 typedef MorphologyHistogramVec<InputImagePixelType,TFunction1> VHistogram;
00068 typedef MorphologyHistogramMap<InputImagePixelType,TFunction1> MHistogram;
00069
00070 bool StartLine(InputImagePixelType * buffer,
00071 InputImagePixelType * inbuffer,
00072 InputImagePixelType &Extreme,
00073 Histogram &histo,
00074 int &outLeftP,
00075 int &outRightP,
00076 int &inLeftP,
00077 int &inRightP,
00078 int middle, unsigned bufflength);
00079
00080 void FinishLine(InputImagePixelType * buffer,
00081 InputImagePixelType * inbuffer,
00082 InputImagePixelType &Extreme,
00083 Histogram &histo,
00084 int &outLeftP,
00085 int &outRightP,
00086 int &inLeftP,
00087 int &inRightP,
00088 int middle, unsigned bufflength);
00089
00090 bool UseVectorBasedHistogram()
00091 {
00092
00093
00094 return typeid(InputImagePixelType) == typeid(unsigned char)
00095 || typeid(InputImagePixelType) == typeid(signed char)
00096 || typeid(InputImagePixelType) == typeid(unsigned short)
00097 || typeid(InputImagePixelType) == typeid(signed short)
00098 || typeid(InputImagePixelType) == typeid(bool);
00099 }
00100
00101 Histogram * m_Histo;
00102
00103 };
00104
00105
00106 }
00107
00108
00109 #ifndef ITK_MANUAL_INSTANTIATION
00110 #include "itkAnchorErodeDilateLine.txx"
00111 #endif
00112
00113 #endif
00114