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

itkKLMSegmentationBorder.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkKLMSegmentationBorder.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/01/15 18:57:02 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) 2002 Insight 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 #ifndef _itkKLMSegmentationBorder_h
00018 #define _itkKLMSegmentationBorder_h
00019 
00020 #include "itkObject.h"
00021 #include "itkSegmentationBorder.h"
00022 
00023 #include "itkKLMSegmentationRegion.h"
00024 #include "itkExceptionObject.h"
00025 
00026 #include "vnl/vnl_matrix.h"
00027 namespace itk
00028 {
00029 
00039 template <class TBorder> 
00040 class KLMDynamicBorderArray
00041 {
00042 public:
00045   bool operator> (const KLMDynamicBorderArray<TBorder>& rhs) const
00046     {  
00047     if( m_Pointer->GetLambda() == rhs.m_Pointer->GetLambda() ) 
00048       { 
00049 
00050       unsigned int lhsArea = ( m_Pointer->GetRegion1()->GetRegionArea() + 
00051         m_Pointer->GetRegion2()->GetRegionArea() );
00052 
00053       unsigned int rhsArea = ( rhs.m_Pointer->GetRegion1()->GetRegionArea() + 
00054         rhs.m_Pointer->GetRegion2()->GetRegionArea() );
00055 
00056       // Compare the total areas of the two neighbors
00057       if( lhsArea == rhsArea )
00058         {
00059         return ( m_Pointer > rhs.m_Pointer );
00060         }
00061       else
00062         {
00063         return ( lhsArea > rhsArea );
00064         }
00065       }
00066     return(m_Pointer->GetLambda() > rhs.m_Pointer->GetLambda() ); 
00067     }
00068 
00069   bool operator> (const KLMDynamicBorderArray<TBorder>* rhs) const
00070     { 
00071     if( m_Pointer->GetLambda() == rhs.m_Pointer->GetLambda() ) 
00072       { 
00073       return ( m_Pointer > rhs.m_Pointer );
00074       }
00075     return(m_Pointer->GetLambda() > rhs.m_Pointer->GetLambda() ); 
00076     }
00077 
00078   TBorder *m_Pointer;
00079 };
00080 
00099 class KLMSegmentationRegion;
00100 
00101 class ITK_EXPORT KLMSegmentationBorder : public SegmentationBorder
00102 {
00103 private:
00105   typedef vnl_matrix<double> VecDblType;
00106 
00107 public:
00109   typedef KLMSegmentationBorder   Self;
00110   typedef SegmentationBorder Superclass;
00111   typedef SmartPointer<Self>  Pointer;
00112   typedef SmartPointer<const Self>  ConstPointer;
00113 
00115   itkNewMacro(Self);
00116 
00118   itkTypeMacro(KLMSegmentationBorder,SegmentationBorder);
00119 
00121   void SetRegion1(KLMSegmentationRegion *Region1);
00122 
00124   KLMSegmentationRegion *GetRegion1();
00125 
00127   void SetRegion2(KLMSegmentationRegion *Region2);
00128 
00130   KLMSegmentationRegion *GetRegion2();
00131 
00134   itkSetMacro(Lambda, double);
00135 
00138   itkGetMacro(Lambda, double);
00139 
00141   void EvaluateLambda();
00142 
00144   void PrintBorderInfo();
00145 
00148   bool operator> (const KLMSegmentationBorder& rhs) const
00149     { return( m_Lambda > rhs.m_Lambda ); }
00150 //    { if( m_Lambda == rhs.m_Lambda) { return ( this > &rhs ); }
00151       
00152 
00153   bool operator> (const KLMSegmentationBorder* rhs) const
00154     { return( (m_Lambda > rhs->m_Lambda) ); }
00155 //    { if( m_Lambda == rhs->m_Lambda) { return ( this > rhs ); }
00156       
00157 
00158 protected:
00160   KLMSegmentationBorder();
00161 
00163   ~KLMSegmentationBorder();
00164 
00166   void PrintSelf(std::ostream& os, Indent indent) const;
00167 
00168 private:
00169   KLMSegmentationBorder(const Self&); //purposely not implemented
00170   void operator=(const Self&); //purposely not implemented
00171 
00172   double                                m_Lambda;
00173   KLMSegmentationRegion *m_Region1;
00174   KLMSegmentationRegion *m_Region2;
00175 
00176 
00177 }; // class KLMSegmentationBorder
00178 
00179 
00180 } // namespace itk
00181 
00182 
00183 #endif

Generated at Fri May 21 01:14:59 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000