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

itkMaximumRatioDecisionRule.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMaximumRatioDecisionRule.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:15 $ 00007 Version: $Revision: 1.7 $ 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 __MaximumRatioDecisionRule_h 00018 #define __MaximumRatioDecisionRule_h 00019 00020 #include "itkWin32Header.h" 00021 00022 #include <vector> 00023 #include "vnl/vnl_matrix.h" 00024 00025 #include "itkNumericTraits.h" 00026 #include "itkDecisionRuleBase.h" 00027 00028 namespace itk { 00029 00044 class ITKCommon_EXPORT MaximumRatioDecisionRule : 00045 public DecisionRuleBase 00046 { 00047 public: 00049 typedef MaximumRatioDecisionRule Self ; 00050 typedef DecisionRuleBase Superclass; 00051 typedef SmartPointer<Self> Pointer; 00052 00054 itkTypeMacro(MaximumRatioDecisionRule, DecisionRuleBase); 00055 00057 itkNewMacro(Self) ; 00058 00059 typedef float APrioriValueType ; 00060 typedef std::vector< APrioriValueType > APrioriVectorType ; 00061 00062 unsigned int Evaluate(std::vector< double > &discriminantScores) ; 00063 00065 void SetAPriori(APrioriVectorType& values) ; 00066 00067 protected: 00068 MaximumRatioDecisionRule() ; 00069 virtual ~MaximumRatioDecisionRule() {} 00070 00071 private: 00073 unsigned int m_NumberOfClasses ; 00074 00076 vnl_matrix< double > m_APrioriRatioMatrix ; 00077 } ; // end of class 00078 00079 inline unsigned int 00080 MaximumRatioDecisionRule::Evaluate(std::vector< double > 00081 &discriminantScores) 00082 { 00083 unsigned int i, j ; 00084 double temp ; 00085 00086 for (i = 0 ; i < m_NumberOfClasses ; i++) 00087 { 00088 j = 0 ; 00089 while ( j < m_NumberOfClasses ) 00090 { 00091 if ( j != i ) 00092 { 00093 if ( discriminantScores[j] != 0.0 ) 00094 { 00095 temp = discriminantScores[i] / discriminantScores[j] ; 00096 } 00097 else 00098 { 00099 temp = NumericTraits< double >::max() ; 00100 } 00101 00102 if ( temp < m_APrioriRatioMatrix.get(i,j) ) 00103 { 00104 break ; 00105 } 00106 } 00107 00108 ++j ; 00109 00110 if ( j == m_NumberOfClasses ) 00111 { 00112 return i ; 00113 } 00114 } 00115 } 00116 00117 return i ; 00118 } 00119 00120 } // end of namespace 00121 #endif 00122 00123 00124 00125 00126 00127 00128

Generated at Sun Apr 1 02:37:19 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000