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

itkMaximumDecisionRule.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMaximumDecisionRule.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/09/10 14:29:15 $
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 __itkMaximumDecisionRule_h
00018 #define __itkMaximumDecisionRule_h
00019 
00020 #include "itkWin32Header.h"
00021 
00022 #include <vector>
00023 #include "itkDecisionRuleBase.h"
00024 
00025 namespace itk{ 
00026 
00032 class ITKCommon_EXPORT MaximumDecisionRule : 
00033     public DecisionRuleBase
00034 {
00035 public:
00037   typedef MaximumDecisionRule Self ;
00038   typedef DecisionRuleBase Superclass;
00039   typedef SmartPointer<Self> Pointer;
00040   typedef SmartPointer<const Self> ConstPointer;
00041 
00043   itkTypeMacro(MaximumDecisionRule, DecisionRuleBase);
00044 
00046   itkNewMacro(Self) ;
00047 
00048   unsigned int Evaluate(std::vector< double > &discriminantScores) ;
00049 
00050 protected:
00051   MaximumDecisionRule() {}
00052   virtual ~MaximumDecisionRule() {}
00053   void PrintSelf(std::ostream& os, Indent indent) const ;
00054 } ; // end of class
00055 
00056 inline unsigned int MaximumDecisionRule::Evaluate(std::vector< double > 
00057                                                   &discriminantScores)
00058 {
00059   double max = discriminantScores[0] ;
00060   unsigned int maxIndex = 0 ;
00061   unsigned int i ;
00062   for (i = 1 ; i < discriminantScores.size() ; i++)
00063     {
00064     if (discriminantScores[i] > max) 
00065       {
00066       max = discriminantScores[i] ;
00067       maxIndex = i ;
00068       }
00069     }
00070   return maxIndex ;
00071 }
00072 
00073 } // end of namespace itk
00074 
00075 #endif
00076 
00077 
00078 
00079 
00080 
00081 
00082 

Generated at Wed Mar 30 00:02:58 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000