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

itkLabelObjectAccessors.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLabelObjectAccessors.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-12 12:57:42 $
00007   Version:   $Revision: 1.6 $
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 #ifndef __itkLabelObjectAccessors_h
00018 #define __itkLabelObjectAccessors_h
00019 
00020 
00021 namespace itk
00022 {
00023 
00024 
00025 namespace Functor 
00026 {
00027 
00028 template< class TLabelObject >
00029 class ITK_EXPORT LabelLabelObjectAccessor
00030 {
00031 public:
00032   typedef TLabelObject                        LabelObjectType;
00033   typedef typename LabelObjectType::LabelType AttributeValueType;
00034 
00035   inline AttributeValueType operator()( const LabelObjectType * labelObject ) const
00036     {
00037     return labelObject->GetLabel();
00038     }
00039 };
00040 
00041 template< class TLabelObject >
00042 class ITK_EXPORT NumberOfLinesLabelObjectAccessor
00043 {
00044 public:
00045   typedef TLabelObject     LabelObjectType;
00046   typedef int              AttributeValueType;
00047 
00048   inline AttributeValueType operator()( const LabelObjectType * labelObject ) const
00049     {
00050     return labelObject->GetNumberOfLines();
00051     }
00052 };
00053 
00054 template< class TLabelObject, class TAttributeAccessor >
00055 class LabelObjectComparator
00056 {
00057 public:
00058   typedef TLabelObject       LabelObjectType;
00059   typedef TAttributeAccessor AttributeAccessorType;
00060   bool operator()( const LabelObjectType * a, const LabelObjectType * b ) const
00061     {
00062     return m_Accessor( a ) > m_Accessor( b );
00063     }
00064   LabelObjectComparator() {}
00065   LabelObjectComparator(LabelObjectComparator const& from)
00066     {
00067     m_Accessor = from.m_Accessor;
00068     }
00069 private:
00070   AttributeAccessorType m_Accessor;
00071 };
00072 
00073 template< class TLabelObject, class TAttributeAccessor >
00074 class LabelObjectReverseComparator
00075 {
00076 public:
00077   typedef TLabelObject       LabelObjectType;
00078   typedef TAttributeAccessor AttributeAccessorType;
00079   bool operator()( const LabelObjectType * a, const LabelObjectType * b ) const
00080     {
00081     return m_Accessor( a ) < m_Accessor( b );
00082     }
00083 
00084   LabelObjectReverseComparator() {}
00085   LabelObjectReverseComparator(LabelObjectReverseComparator const& from)
00086     {
00087     m_Accessor = from.m_Accessor;
00088     }
00089 private:
00090   AttributeAccessorType m_Accessor;
00091 };
00092 
00093 }
00094 
00095 
00096 } // end namespace itk
00097 
00098 #endif
00099 

Generated at Fri Apr 16 18:53:51 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000