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