/** 
* @file Feature.cpp
* @brief abstraction of a feature
* @author Erik Rodner
* @date 04/21/2008

*/
#include "core/image/ImageT.h"
#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"

#include <iostream>

#include "Feature.h"
#include "FeaturePool.h"

using namespace OBJREC;

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



Feature::Feature()
{
}

Feature::~Feature()
{
}

void Feature::calcFeatureValues ( const Examples & examples,
				    vector<int> & examples_selection,
				    FeatureValues & values ) const
{
    for ( vector<int>::const_iterator si = examples_selection.begin();
				   si != examples_selection.end();
				   si++ )
    {
	int index = *si;
	const pair<int, Example> & p = examples[index];
	int classno = p.first;
	const Example & ce = p.second;
	double value = val ( &ce );
	values.insert ( quadruplet<double, int, int,double> ( value, classno, index, ce.weight ) );
    }
}

void Feature::calcFeatureValues ( const Examples & examples,
				    vector<int> & examples_selection,
				    FeatureValuesUnsorted & values ) const
{
    for ( vector<int>::const_iterator si = examples_selection.begin();
				   si != examples_selection.end();
				   si++ )
    {
	int index = *si;
	const pair<int, Example> & p = examples[index];
	int classno = p.first;
	const Example & ce = p.second;
	double value = val ( &ce );
	values.push_back ( quadruplet<double, int, int, double> ( value, classno, index, ce.weight ) );
    }
}

