00001 #ifndef __ImageSample__ 00002 #define __ImageSample__ 00003 00004 00023 #include <stdio.h> 00024 00025 #include "RectObjectArea.hpp" 00026 00027 00028 class ImageSample 00029 { 00030 private: 00031 00032 char* filename; // image file 00033 00034 int width, height; 00035 00036 int n, nmax; 00037 RectObjectArea** oArea; 00038 00039 00040 public: 00041 00042 ImageSample(char* name, int w, int h, int aNmax=64); 00043 ImageSample(FILE* file); // reading from file stream 00044 virtual ~ImageSample(); 00045 00046 int getWidth(){ return width; } 00047 int getHeight(){ return height; } 00048 00049 00050 void setFilename(char* name); 00051 char* getFilename(){ return filename; } 00052 00053 int numberOfAreas(){ return n; } 00054 int maxAreas(){ return nmax; } 00055 void extendSet(int nitems); 00056 00057 RectObjectArea* get(int i){ return oArea[i]; } 00058 void set(int i, RectObjectArea* region ){ oArea[i]= region; } 00059 00060 void add(RectObjectArea* region); 00061 void addAt(int index, RectObjectArea* region); 00062 void remove(int i); 00063 00064 // queuing 00065 RectObjectArea* dequeue(){RectObjectArea* first=get(0); remove(0); return first;} 00066 void enqueue(RectObjectArea* region){ add(region); } 00067 00068 int numberOfPixels(int iObject); 00069 00070 // I/O operations 00071 void write(FILE* file); 00072 00073 void output(); 00074 }; 00075 00076 00077 #endif