00001 #ifndef GrayLevelImage8_H 00002 #define GrayLevelImage8_H 00003 00004 #include "SingleElementImage.h" 00005 #include "ImageSuperClasses.h" 00006 #include "MultiElementImage.h" 00007 00008 namespace puma2 { 00009 00010 typedef unsigned char byte; 00011 00016 class GrayLevelImage8 : 00017 public SingleElementImage<byte> 00018 { 00019 public: 00020 00024 GrayLevelImage8(int xwidth = 0, int height = 0); 00025 00026 GrayLevelImage8(const GrayLevelImage8 &); 00027 00038 GrayLevelImage8(int width, int height, GrayLevelImage8 * m, int xo, int yo); 00039 00043 ~GrayLevelImage8(); 00044 00046 double getElementTypeMinimum() const { return 0; }; 00047 00049 double getElementTypeMaximum() const { return 255; }; 00050 00052 void readFromFile(const char * fileName); 00054 void writeToFile(const char * fileName) const; 00055 00059 MultiElementImage<byte,1> & asMultiElementImage(); 00060 // we could initialize alt only, when we need it 00061 // { if (alt == NULL) alt = new ...; return *alt; } 00062 // but we would have to store xo, yo, -- another 00063 // DESIGN OPTION 00064 00076 operator MultiElementImage<byte,1>& () { return asMultiElementImage(); } 00077 00078 void operator= (const GrayLevelImage8 & g) { 00079 SingleElementImage<byte>::operator=(g); 00080 } 00081 00082 protected: 00083 virtual void reset(); 00084 private: 00085 MultiElementImage<byte,1> * alt; 00086 }; 00087 00088 } 00089 00090 #endif