#ifndef __IMAGESIFT_H__
#define __IMAGSSIFT_H__

#include "featuresift.h"
#include "image2d.h"
#include "scalespace.h"
#include "emcluster.h"

class imagesift
{
 public:
  struct featurepair
  {
    featuresift *a;
    featuresift *b;
    double score;
  };
  imagesift();
  ~imagesift();
  int init( image2d &im );
  int match( imagesift &o, 
             std::list< featurepair > &fp,
             Magick::Image ima, 
             Magick::Image imb );
  int selfsearch();
  int clear();
  int clearimages();
 private:
  int match( std::vector< featuresift* > &a,
             std::vector< featuresift* > &b,
             std::map< unsigned long int, std::vector< featurepair > > &ab );

  int cluster_filter( std::list<featurepair> &fp );

  int calc_magori( image2d &in, image2d *mag, image2d *ori );
  //  image2d origim;
  std::vector< scalespace::scales* > scales;
  std::map< double, scalespace::scales* > scalemap;
  std::map< double, image2d* > magmap;
  std::map< double, image2d* > orimap;
  std::vector< featuresift* > myfeatures;
};

#endif
