/** 
* @file KMeansMatlab.h
* @brief K-Means using a matlab implementation
* @author Erik Rodner
* @date 10/29/2007

*/
#ifndef KMeansMatlabINCLUDE
#define KMeansMatlabINCLUDE

#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"

#include "core/basics/Config.h"
#include "ClusterAlgorithm.h"


namespace OBJREC {

  /** 
  * @class KMeansMatlab
  * @brief K-Means using a matlab implementation
  * @author Erik Rodner
  */

  class KMeansMatlab : public ClusterAlgorithm
  {

      protected:
        int noClusters;
        // refactor-nice.pl: check this substitution
        // old: string kmeansDir;
        std::string kmeansDir;
        // refactor-nice.pl: check this substitution
        // old: string matlabExec;
        std::string matlabExec;
        // refactor-nice.pl: check this substitution
        // old: string matlabArgs;
        std::string matlabArgs;

        // refactor-nice.pl: check this substitution
        // old: string inputFN;
        std::string inputFN;
        // refactor-nice.pl: check this substitution
        // old: string outputFN;
        std::string outputFN;

        FILE *matlabPipe;
        
        int compute_prototypes ( const NICE::VVector & features,
                NICE::VVector & prototypes,
                std::vector<double> & weights,
                const std::vector<int>    & assignment );


      public:
    
        /** 
        * @brief simple constructor
        * @author Erik Rodner, Alexander Freytag
        * Among others, you can specify for "section" the following attributes: "source_root", "tmpInput", "tmpOutput", "matlab_exec", "matlab_args"
        */
        KMeansMatlab( const NICE::Config *conf,  const std::string & _section = "KMeansMatlab" );
            
        /** simple destructor */
        virtual ~KMeansMatlab();
          
        void cluster ( const NICE::VVector & features,
                NICE::VVector & prototypes,
                std::vector<double> & weights,
                std::vector<int>    & assignment );

  };


} // namespace

#endif
