| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkMaximumDecisionRule.cxx.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:41 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
DEF |
=========================================================================*/ |
| 17 |
|
#include "itkMaximumDecisionRule.h" |
| 18 |
|
|
| 19 |
NMS |
namespace itk{ |
| 20 |
|
|
| 21 |
|
void |
| 22 |
|
MaximumDecisionRule::PrintSelf(std::ostream& os, Indent indent) const |
| 23 |
|
{ |
| 24 |
SEM |
Superclass::PrintSelf(os, indent) ; |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
unsigned int |
| 29 |
|
MaximumDecisionRule::Evaluate(const VectorType &discriminantScores) const |
| 30 |
|
{ |
| 31 |
SEM |
double max = discriminantScores[0] ; |
| 32 |
SEM |
unsigned int maxIndex = 0 ; |
| 33 |
SEM |
unsigned int i ; |
| 34 |
SEM,SEM |
for (i = 1 ; i < discriminantScores.size() ; i++) |
| 35 |
|
{ |
| 36 |
|
if (discriminantScores[i] > max) |
| 37 |
|
{ |
| 38 |
SEM |
max = discriminantScores[i] ; |
| 39 |
SEM |
maxIndex = i ; |
| 40 |
|
} |
| 41 |
|
} |
| 42 |
SEM |
return maxIndex ; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
unsigned int |
| 47 |
|
MaximumDecisionRule::Evaluate(const ArrayType &discriminantScores) const |
| 48 |
|
{ |
| 49 |
SEM |
double max = discriminantScores[0] ; |
| 50 |
SEM |
unsigned int maxIndex = 0 ; |
| 51 |
SEM |
unsigned int i ; |
| 52 |
SEM,SEM |
for (i = 1 ; i < discriminantScores.Size() ; i++) |
| 53 |
|
{ |
| 54 |
|
if (discriminantScores[i] > max) |
| 55 |
|
{ |
| 56 |
SEM |
max = discriminantScores[i] ; |
| 57 |
SEM |
maxIndex = i ; |
| 58 |
|
} |
| 59 |
|
} |
| 60 |
SEM |
return maxIndex ; |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
unsigned int |
| 64 |
LEN |
MaximumDecisionRule::Evaluate(const VariableLengthVectorType &discriminantScores) const |
| 65 |
|
{ |
| 66 |
SEM |
double max = discriminantScores[0] ; |
| 67 |
SEM |
unsigned int maxIndex = 0 ; |
| 68 |
SEM |
unsigned int i ; |
| 69 |
SEM,SEM |
for (i = 1 ; i < discriminantScores.Size() ; i++) |
| 70 |
|
{ |
| 71 |
|
if (discriminantScores[i] > max) |
| 72 |
|
{ |
| 73 |
SEM |
max = discriminantScores[i] ; |
| 74 |
SEM |
maxIndex = i ; |
| 75 |
|
} |
| 76 |
|
} |
| 77 |
SEM |
return maxIndex ; |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
} // end of namespace itk |
| 82 |
|
|
| 83 |
EOF |
|
| 84 |
EOF,EML |
|
| 85 |
EOF,EML |
|
| 86 |
EOF,EML |
|
| 87 |
EOF,EML |
|
| 88 |
EOF,EML |
|
| 89 |
EOF,EML |
|