/** 
* @file FeaturePoolClassifier.cpp
* @brief abstract interface for a classifier using feature selection
* @author Erik Rodner
* @date 04/21/2008

*/

#include <iostream>

#include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
#include "vislearning/baselib/ICETools.h"


using namespace OBJREC;

using namespace std;
// refactor-nice.pl: check this substitution
// old: using namespace ice;
using namespace NICE;

FeaturePoolClassifier::FeaturePoolClassifier() : maxClassNo(-1)
{
}

FeaturePoolClassifier::~FeaturePoolClassifier()
{
}

// refactor-nice.pl: check this substitution
// old: ClassificationResult FeaturePoolClassifier::classify ( const Image & img )
ClassificationResult FeaturePoolClassifier::classify ( const NICE::Image & img )
{
    CachedExample ce ( img );
    // refactor-nice.pl: check this substitution
    // old: Example pce ( &ce, img->xsize/2, img->ysize/2 );
    Example pce ( &ce, img.width()/2, img.height()/2 );
    // refactor-nice.pl: check this substitution
    // old: pce.width = img->xsize;
    pce.width = img.width();
    // refactor-nice.pl: check this substitution
    // old: pce.height = img->ysize;
    pce.height = img.height();

    return classify ( pce );
}
    
// refactor-nice.pl: check this substitution
// old: ClassificationResult FeaturePoolClassifier::classifyRGB ( const ImageRGB & img )
ClassificationResult FeaturePoolClassifier::classifyRGB ( const NICE::ColorImage & img )
{
    CachedExample ce ( img );
    // refactor-nice.pl: check this substitution
    // old: Example pce ( &ce, img.xsize()/2, img.ysize()/2 );
    Example pce ( &ce, img.width()/2, img.height()/2 );
    // refactor-nice.pl: check this substitution
    // old: pce.width = img.xsize();
    pce.width = img.width();
    // refactor-nice.pl: check this substitution
    // old: pce.height = img.ysize();
    pce.height = img.height();

    return classify ( pce );
}
	
void FeaturePoolClassifier::setMaxClassNo( int classno )
{
    maxClassNo = classno;
}

int FeaturePoolClassifier::getMaxClassNo () const
{
    return maxClassNo;
}

void FeaturePoolClassifier::setComplexity ( int size )
{
    fprintf (stderr, "FeaturePoolClassifier::setComplexity: not yet implemented in subordinate class\n");
    exit(-1);
}

void FeaturePoolClassifier::addMultipleExamples( OBJREC::Examples & newExamples)
{
    fprintf (stderr, "FeaturePoolClassifier::addMultipleExamples: not yet implemented in subordinate class\n");
    exit(-1);
}