#ifndef __GLCPIMAGE_H__
#define __GLCPIMAGE_H__

#include "GLCP.h"
#include "dbhmm.h"
#include "common.h"

class GLCPimage
{
 public:

  struct thread_d
  {
    pthread_t tid;
    image2d *im;
    image2d *classmap;
    image2d *class1score;
    image2d *class2score;
    image2d *immask;
    GLCP::mask mymask;
    dbhmm *curhmmdb;
    dbhmm::thread_d tbd;
    int mod;
    int step;
    int start;
  };

  GLCPimage();
  ~GLCPimage();

  int load( Magick::Image &mim );

  int classifyimage( image2d *im, dbhmm *mydb,
                     GLCP::mask &mymask, int step, image2d *immask = NULL );

  int overlay( Magick::Image &mim );

  image2d *getresult()
  {
    return &classmap;
  }

  int seperate_histogram( Magick::Image &mim );

  /// majority voting using neighboring classification in a radius
  int classify_vote( int radius );

 private:

  image2d *curim;
  image2d classmap;
  image2d class1score;
  image2d class2score;
  dbhmm *curhmmdb;
};

#endif
