openModeller  Version 1.4.0
AreaStats.cpp
Go to the documentation of this file.
00001 
00030 #include <openmodeller/AreaStats.hh>
00031 #include <openmodeller/Configuration.hh>
00032 
00033 AreaStats::AreaStats(Scalar predictionThreshold)
00034 {
00035   reset(predictionThreshold);
00036 }
00037 
00038 AreaStats::AreaStats(const AreaStats *areaStats) :
00039   _areaTotal( areaStats->getTotalArea() ),
00040   _areaPredPresent( areaStats->getAreaPredictedPresent() ),
00041   _areaPredAbsent( areaStats->getAreaPredictedAbsent() ),
00042   _areaNotPredicted( areaStats->getAreaNotPredicted() ),
00043   _predictionThreshold( areaStats->getPredictionThreshold() )
00044 { }
00045 
00046 AreaStats::~AreaStats()
00047 {
00048 }
00049 
00050 void AreaStats::reset(Scalar predictionThreshold)
00051 {
00052   _predictionThreshold = predictionThreshold;
00053   _areaTotal = _areaPredPresent = _areaPredAbsent = _areaNotPredicted = 0;
00054 }
00055 
00056 
00057 void AreaStats::addPrediction(Scalar value)
00058 {
00059   _areaTotal++;
00060   if (value >= _predictionThreshold)
00061     { _areaPredPresent++; }
00062   else 
00063     { _areaPredAbsent++; }
00064 }
00065 
00066 
00067 void AreaStats::addNonPrediction()
00068 {
00069   _areaTotal++;
00070   _areaNotPredicted++;
00071 }
00072 
00073 
00074 ConfigurationPtr 
00075 AreaStats::getConfiguration() const
00076 {
00077   ConfigurationPtr config( new ConfigurationImpl("AreaStatistics") );
00078 
00079   config->addNameValue( "TotalCells", _areaTotal );
00080   config->addNameValue( "CellsPredicted", _areaPredPresent );
00081   config->addNameValue( "PredictionThreshold", _predictionThreshold );
00082 
00083   return config;
00084 }
00085