freImageClassificationSOMetricMonitor.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freImageClassificationSOMetricMonitor.cxx,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 
00023 #include "freImageClassificationSOMetricMonitor.h"
00024 
00025 #include "itkNumericTraits.h"
00026 
00027 namespace FREE
00028 {
00029 
00033   ImageClassificationSOMetricResult::
00034   ImageClassificationSOMetricResult()
00035   {
00036     this->Reset();
00037   };
00038 
00039   void
00040   ImageClassificationSOMetricResult::
00041   Reset()
00042   {
00043                 m_TP = 0;
00044                 m_FP = 0;
00045                 m_TN = 0;
00046                 m_FN = 0;
00047                 m_Duration = 0;
00048   };
00049 
00053 ImageClassificationSOMetricMonitor::
00054 ImageClassificationSOMetricMonitor()
00055 {};
00056 
00057 ImageClassificationSOMetricMonitor::
00058 ~ImageClassificationSOMetricMonitor()
00059 {
00060 };
00061 
00062 void
00063 ImageClassificationSOMetricMonitor::
00064 InsertEvaluationResults(const ResultType& results)
00065 {
00066   m_TPs.push_back(results.GetTP());
00067   m_FPs.push_back(results.GetFP());
00068   m_TNs.push_back(results.GetTN());
00069   m_FNs.push_back(results.GetFN());
00070   m_Durations.push_back(results.GetDuration());
00071 };
00072 
00073 void
00074 ImageClassificationSOMetricMonitor::
00075 CopyAdaptationResults(const ResultIndexType& index, ResultType& results) const
00076 {
00077   results.SetTP(m_TPs[index]);
00078   results.SetFP(m_FPs[index]);
00079   results.SetTN(m_TNs[index]);
00080   results.SetFN(m_FNs[index]);
00081   results.SetDuration(m_Durations[index]);
00082 };
00083 
00084 void
00085 ImageClassificationSOMetricMonitor::
00086 EnlistResultsToStatistic(const ResultType& results, StatisticEntry& entry)
00087 {
00088   double sensitivity = double(results.GetTP())/double(results.GetTP()+results.GetFN());
00089   double specificity = double(results.GetTN())/double(results.GetFP()+results.GetTN());
00090   double ppv = double(results.GetTP())/double(results.GetTP()+results.GetFP());
00091   double npv = double(results.GetTN())/double(results.GetTN()+results.GetFN());
00092 
00093   if (results.GetTP()+results.GetFN()==0) sensitivity = -1.0;
00094   if (results.GetFP()+results.GetTN()==0) specificity = -1.0;
00095   if (results.GetTP()+results.GetFP()==0) ppv = -1.0;
00096   if (results.GetTN()+results.GetFN()==0) npv = -1.0;
00097 
00098   entry.AddValue(Convert::ToStr(sensitivity),2);
00099   entry.AddValue(Convert::ToStr(specificity),3);
00100   entry.AddValue(Convert::ToStr(ppv),4);
00101   entry.AddValue(Convert::ToStr(npv),5);
00102   entry.AddValue(Convert::ToStr(results.GetDuration()),6);
00103 };
00104 
00105 void
00106 ImageClassificationSOMetricMonitor::
00107 EnlistDictionaryEntries(StatisticDictionary& dictionary)
00108 {
00109   dictionary.AddValueDefinition(this->GetNameOfClass(),"Sensitivity", "The sensitivity is the proportion of true positives of all pixels belonging to the class");
00110   dictionary.AddValueDefinition(this->GetNameOfClass(),"Specitvity", "The specificity is the proportion of true negatives of all pixels not belonging to the class");
00111   dictionary.AddValueDefinition(this->GetNameOfClass(),"Positive predictive value", "The proportion of classified pixels who are correctly classified");
00112   dictionary.AddValueDefinition(this->GetNameOfClass(),"Negative predictive value", "The proportion of non classified pixels who are correctly classified");
00113   dictionary.AddValueDefinition(this->GetNameOfClass(),"Duration", "Duration of the registration in 1/10 sec");
00114 };
00115 
00116 
00117 } // end namespace FREE

Generated at Sat Oct 13 16:02:21 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000