00001 #ifndef __ImageSampleSet__ 00002 #define __ImageSampleSet__ 00003 00004 00023 #include <stdio.h> 00024 00025 #include "ImageSample.hpp" 00026 00027 #include "DataSample.hpp" 00028 00029 class ImageSampleSet 00030 { 00031 private: 00032 00033 char* filename; 00034 char* title; 00035 00036 int n, nmax; 00037 ImageSample** imSample; 00038 00039 int nChannels; 00040 00041 int nObjects; 00042 unsigned char nClasses[255]; 00043 int nData[255]; 00044 00045 bool active; 00046 int currentObject; 00047 00048 00049 int x0,y0,x1,y1; 00050 00051 public: 00052 00053 ImageSampleSet(int aNmax=255, int channels=3); 00054 ImageSampleSet(FILE* file); // reading from file stream 00055 virtual ~ImageSampleSet(); 00056 00057 void load(FILE* file); 00058 void clear(); 00059 00060 int getChannels(){ return nChannels; } 00061 void setChannels(int val){ nChannels= val; } 00062 00063 int numberOfPixels(int iObject); 00064 void evaluateDataSizes(); 00065 DataSample* generateData(int iObject, int nFeature); 00066 00067 void setTitle(char* name); 00068 char* getTitle(){ return title; } 00069 00070 void setFilename(char* name); 00071 char* getFilename(){ return filename; } 00072 00073 bool isActive(){ return active; } 00074 void setActive(bool value){ active= value; } 00075 00076 void setPoint0( int x, int y ){ x0= x; y0= y; } 00077 void setPoint1( int x, int y ){ x1= x; y1= y; } 00078 00079 int getX0(){return x0;} 00080 int getY0(){return y0;} 00081 int getX1(){return x1;} 00082 int getY1(){return y1;} 00083 00084 int numberOfSamples(){ return n; } 00085 int maxItems(){ return nmax; } 00086 void extendSet(int nitems); 00087 00088 int getCurrentObject(){ return currentObject; } 00089 void setCurrentObject(int index){ currentObject= index; } 00090 00091 int getNumberOfObjects(){ return nObjects; } 00092 void setNumberOfObjects(int n){ nObjects= n; } 00093 00094 int getNumberOfClasses(int oi){ return nClasses[oi]; } 00095 void setNumberOfClasses(int oi, int n){ nClasses[oi]= n; } 00096 00097 ImageSample* get(int i){ return imSample[i]; } 00098 void set(int i, ImageSample* sample ){ imSample[i]= sample; } 00099 00100 void add(ImageSample* sample); 00101 void addAt(int index, ImageSample* sample); 00102 void remove(int i); 00103 00104 // queuing 00105 ImageSample* dequeue(){ImageSample* first=get(0); remove(0); return first;} 00106 void enqueue(ImageSample* sample){ add(sample); } 00107 00108 // I/O operations 00109 void write(FILE* file); 00110 00111 void output(); 00112 }; 00113 00114 00115 #endif