/**
 * @file NDCodebookLevelImagePooling.h
 * @brief Compute novelty of images based on relations between extracted features and current codebook, pool novelty scores over the whole image without considering spatial information
 * @author Alexander Freytag
 * @date 02-05-2013 (dd-mm-yyyy)
*/
#ifndef _NDCODEBOOKLEVELIMAGEPOOLING
#define _NDCODEBOOKLEVELIMAGEPOOLING

#include "NoveltyDetectorCodebookLevel.h"

//core
#include <core/vector/Distance.h>
#include <core/vector/VVector.h>

// vislearning
#include <vislearning/cbaselib/MultiDataset.h>
// 
#include <vislearning/features/localfeatures/GenericLocalFeatureSelection.h>
// 
#include <vislearning/math/cluster/ClusterAlgorithm.h>




namespace OBJREC
{

  /**
   * @class NDCodebookLevelImagePooling
   * @brief Compute novelty of images based on relations between extracted features and current codebook, pool novelty scores over the whole image without considering spatial information
   * @author Alexander Freytag
   * @date 02-05-2013 (dd-mm-yyyy)
  */  
  
  class NDCodebookLevelImagePooling : public NoveltyDetectorCodebookLevel
  {

    protected:
      
      /************************
       * 
       *   protected variables
       * 
       **************************/       
      
      //TODO ENUM HOW TO POOL
      
      //! this is the (stupid) global threshold for novelty within an image (i.e., if novelty scores summed over all pixels and divided by image size is larger than this score, the image is considered as "novel")      
      double d_noveltyThreshold;
                       
      
      /************************
       * 
       *   protected methods
       * 
       **************************/
    


    public:

      /** constructor
        * @param _conf needs a configfile
        * @param _md and a MultiDataset (contains images and other things)
        * @param _section section information for parsing config files
        */
      NDCodebookLevelImagePooling ( const NICE::Config *_conf, const OBJREC::MultiDataset *_md , const std::string & _section = "noveltyDetector");

      /** simple destructor */
      virtual ~NDCodebookLevelImagePooling();
      
      /** 
       * @brief  Evaluate whether or not the image of the specified filename is novel with respect to the current known examples or not
       * @author Alexander Freytag
       * @date 02-05-2013 (dd-mm-yyyy)
       * @param _filename of the new image 
       * @return bool (true: class/content/... of image is novel, false: class/content/... of image is known)
       * @note This function has to be overloaded by all subclasses!          
      */
      virtual bool evaluateNoveltyOfImage ( const std::string & _filename );
      
      /** 
       * @brief  Evaluate whether or not the image of the specified filename is novel with respect to the current known examples or not
       * @author Alexander Freytag
       * @date 02-05-2013 (dd-mm-yyyy)
       * @param _noveltyImage contains min distances of features to the current codebook
       * @return bool (true: class/content/... of image is novel, false: class/content/... of image is known)
      */      
      virtual bool evaluateNoveltyOfImage ( const NICE::FloatImage & _noveltyImage ) ;                  

  };


} // namespace

#endif
