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