00001 #ifndef _ShortImage_H 00002 #define _ShortImage_H 00003 00004 00023 #include <stdio.h> 00024 00025 #include "AnImage.hpp" 00026 #include "RImage.hpp" 00027 #include "CImage.hpp" 00028 #include "FImage.hpp" 00029 00030 class ShortImage : public AnImage 00031 { 00032 private: 00033 00034 short* image; 00035 00036 public: 00037 00038 ShortImage(int w, int h); 00039 ShortImage(int w, int h, int data); 00040 ShortImage(int w, int h, short* data); 00041 ShortImage(RImage& data); 00042 virtual ~ShortImage(){ delete[] image; } 00043 00044 virtual void set(RImage& data, int ch=0); 00045 virtual void set(FImage& data, int ch=0); 00046 virtual void set(CImage& data, int ctype=0, int ch=0){} 00047 00048 virtual AnImage* copy(); 00049 00050 // data limits of each image type 00051 virtual int getMinBoundaryValue(){ return -32768; } 00052 virtual int getMaxBoundaryValue(){ return 32767; } 00053 virtual int getPower2MaxRangeBoundary(){ return 15; } 00054 00055 virtual AnImage* rotate90Left(){ return 0; } 00056 virtual AnImage* rotate90Right(){ return 0; } 00057 00058 virtual AnImage* scaleDown(int multiplier=2); 00059 virtual AnImage* scaleUp(int multiplier=2); 00060 virtual AnImage* zeroInterleaving(); 00061 00062 virtual AnImage* partImage(int x0=0, int y0=0, int w=256, int h=256); 00063 virtual AnImage* subImage(int x0, int y0, int x1, int y1); 00064 virtual AnImage* smallImage(double xscale, double yscale); 00065 00066 00067 virtual int getRed(int x, int y){ return image[x+width*y]; } 00068 virtual int getGreen(int x, int y){ return image[x+width*y]; } 00069 virtual int getBlue(int x, int y){ return image[x+width*y]; } 00070 virtual int getGrey(int x, int y){ return image[x+width*y]; } 00071 00072 virtual void setRed(int x, int y, int value){ image[x+width*y]=value; } 00073 virtual void setGreen(int x, int y, int value){ image[x+width*y]=value; } 00074 virtual void setBlue(int x, int y, int value){ image[x+width*y]=value; } 00075 virtual void setGrey(int x, int y, int value){ image[x+width*y]=value; } 00076 00077 virtual void set(int x, int y, int value){ image[x+width*y]=value; } 00078 virtual int get(int x, int y) 00079 { return image[x+width*y]; } 00080 00081 // RGB simulation 00082 virtual void setRGB(int x, int y, int r, int g, int b) 00083 { 00084 int val= (3*r+5*g+2*b)/10; 00085 00086 image[x+width*y]=val; 00087 } 00088 00089 virtual unsigned char* getData(){ return (unsigned char*)image; } 00090 00091 virtual void restaure(int iterations, double coeff){} 00092 virtual void restaure(int type, int iterations, double coeff){} 00093 00094 virtual void report(FILE* file); 00095 virtual void output(); 00096 }; 00097 00098 #endif