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: 2002/06/11 07:18:33 $
00007   Version:   $Revision: 1.1 $
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 __itkMaximumDecisionRule_h
00018 #define __itkMaximumDecisionRule_h
00019 
00020 #include <vector>
00021 #include "itkDecisionRuleBase.h"
00022 
00023 namespace itk{ 
00024 
00029 class ITK_EXPORT MaximumDecisionRule : 
00030       public DecisionRuleBase
00031 {
00032 public:
00034   typedef MaximumDecisionRule Self ;
00035   typedef DecisionRuleBase Superclass;
00036   typedef SmartPointer<Self> Pointer;
00037 
00039   itkTypeMacro(MaxDecisionRule, DecisionRuleBase);
00040 
00042   itkNewMacro(Self) ;
00043 
00044   unsigned int Evaluate(std::vector< double > &discriminantScores) ;
00045 
00046 protected:
00047   MaximumDecisionRule() {}
00048   virtual ~MaximumDecisionRule() {}
00049   void PrintSelf(std::ostream& os, Indent indent) const ;
00050 } ; // end of class
00051 
00052 inline unsigned int MaximumDecisionRule::Evaluate(std::vector< double > 
00053                                                   &discriminantScores)
00054 {
00055   double max = discriminantScores[0] ;
00056   unsigned int maxIndex = 0 ;
00057   unsigned int i ;
00058   for (i = 1 ; i < discriminantScores.size() ; i++)
00059     {
00060       if (discriminantScores[i] > max) 
00061         {
00062           max = discriminantScores[i] ;
00063           maxIndex = i ;
00064         }
00065     }
00066   return maxIndex ;
00067 }
00068 
00069 } // end of namespace itk
00070 
00071 #endif
00072 
00073 
00074 
00075 
00076 
00077 
00078 

Generated at Wed Mar 12 01:13:05 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000