Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkAnchorOpenCloseLine.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAnchorOpenCloseLine.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-20 16:32:08 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkAnchorOpenCloseLine_h
00019 #define __itkAnchorOpenCloseLine_h
00020 
00021 #include "itkAnchorHistogram.h"
00022 
00023 //#define RAWHIST
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     // bool, short and char are acceptable for vector based algorithm: they do not require
00084     // too much memory. Other types are not usable with that algorithm
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 }; // end of class
00095 
00096 
00097 } // end namespace itk
00098 
00099 
00100 #ifndef ITK_MANUAL_INSTANTIATION
00101 #include "itkAnchorOpenCloseLine.txx"
00102 #endif
00103 
00104 #endif
00105 

Generated at Tue Sep 15 02:07:56 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000