#ifndef __SUBIMAGE__
#define __SUBIMAGE__
#ifndef _NOMAGICK_
#include <Magick++.h>
#endif
#include <iostream>
#include <math.h>
/**
   creates a subimage from an area in a larger image
 */
class subimage
{
 public:
  subimage();
  subimage( const subimage &in );
  ~subimage();
  ///initializes the image data
  int init(double *data, int up, int low, int left,
           int right, int x, int y);
  ///obtains a pixel
  double getpixel(int x, int y);
  ///sets a pixel
  int setpixel(double value, int x, int y);

#ifndef _NOMAGICK_
  ///copy subimage to magick
  int getimage(Magick::Image &im);
#endif

  ///get size
  int getsizex();
  ///get size
  int getsizey();
 private:
  double *image;
  int sizex;
  int sizey;
  int up;
  int low;
  int left;
  int right;
};

#endif
