#include "hmm.h"
#include "GLCP.h"
#include "GLCPimage.h"
#include "dbimage.h"
#include "bdbenv.h"
#include "dbalnimage.h"
#include "dbtmpfeature.h"
#include <tclap/CmdLine.h>
#include "dbhmm.h"
#include <string>

int main( int argc, char *argv[] )
{

#ifndef _NOMAGICK_

  try
    {
      ///set up the command line parsing
      TCLAP::CmdLine cmd("Image alignment program", ' ', "0.001");

      TCLAP::ValueArg<std::string> inputimage("i", "image", "image", 
                                              true, "", "0" );
      TCLAP::ValueArg<std::string> outputimage("o", "outimage", "image", 
                                              true, "", "0" );

      TCLAP::ValueArg< int > rin( "r", "radius", "radius", true, 1, 
                                  "the model number to use" );

      cmd.add(inputimage);
      cmd.add(outputimage);
      cmd.add(rin);
      cmd.parse(argc, argv);

      GLCPimage gi;

      image2d im;
      Magick::Image mim1;
      //Magick::Image mim;

      mim1.read( inputimage.getValue().c_str() );      
      gi.load( mim1 );
      gi.classify_vote( rin.getValue() );

      Magick::Geometry geo = mim1.size();
      //im.size(geo);
      Magick::Image mim(geo, Magick::Color("black"));

      gi.overlay( mim );
      mim.write( outputimage.getValue() );
    }
  catch (TCLAP::ArgException &e)
    {
      std::cout << "ERROR: " << e.error() 
                << " for arg " << e.argId() << "\n";
      return 0;
    }
  
#else
  std::cout << "compiled with no image magick\n";
#endif
  return 0;
}
