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

itkAnchorErodeDilateLine.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAnchorErodeDilateLine.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-20 16:32:08 $
00007   Version:   $Revision: 1.3 $
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 __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     // bool, short and char are acceptable for vector based algorithm: they do not require
00093     // too much memory. Other types are not usable with that algorithm
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 }; // end of class
00104 
00105 
00106 } // end namespace itk
00107 
00108 
00109 #ifndef ITK_MANUAL_INSTANTIATION
00110 #include "itkAnchorErodeDilateLine.txx"
00111 #endif
00112 
00113 #endif
00114 

Generated at Wed Nov 5 20:15:42 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000