#include <core/imagedisplay/ImageDisplay.h>

#ifdef NICE_USELIB_ICE

#include <iostream>
#include <core/iceconversion/convertice.h>

#include "vislearning/classifier/vclassifier/VecClassifierICE.h"

using namespace OBJREC;

using namespace std;

using namespace NICE;

VecClassifierICE::VecClassifierICE( 
		 const Config *_conf, 
		 ice::Classifier *_classifier ) :
	VecClassifier ( _conf ), 
	classifier(_classifier) 
{
}

VecClassifierICE::~VecClassifierICE()
{
}

ClassificationResult VecClassifierICE::classify ( const NICE::Vector & x ) const
{
    return ClassificationResult ( classifier->Classify ( NICE::makeIceVectorT(x) ), 1.0, maxClassNo );
}

void VecClassifierICE::teach ( const LabeledSetVector & teachSet )
{
    maxClassNo = teachSet.getMaxClassno();
    LOOP_ALL(teachSet) 
    {
	EACH(classno,x);
	classifier->Teach ( classno, NICE::makeIceVectorT(x) );
    }
}


void VecClassifierICE::clear ()
{
    classifier->Init(); // FIXME
}

void VecClassifierICE::store ( std::ostream & os ) const
{
    (*classifier) >> os;
}

void VecClassifierICE::restore ( std::istream & is )
{
    (*classifier) << is;
}

void VecClassifierICE::finishTeaching () 
{
    fprintf (stderr, "ICEClassifier Finish() !!\n");
    classifier->Finish();
}

#endif
