00001 #ifndef __IMAGE_H 00002 #define __IMAGE_H 00003 00004 #include "windows_defs.h" 00005 00006 #include <qimage.h> 00007 #include <qpixmap.h> 00008 00009 #include <string> 00010 #include <vector> 00011 00012 #include "imageformat.h" 00013 #include "inmemformat.h" 00014 #include "imagestate.h" 00015 #include "shape.h" 00016 00017 #include "TraceLog.h" 00018 00036 class GV_EXPORT Image { 00037 public: 00038 typedef enum { 00039 NEAREST_NEIGHBOR, 00040 BILINEAR, 00041 BICUBIC 00042 } ResampleMethod; 00043 00044 typedef enum { 00045 LSAT7_GEOTIFF, 00046 LSAT7_NLAPS, 00047 LSAT7_FASTL7A, 00048 GENERIC 00049 } MultiFileType; 00050 00051 static std::string MFF_NAMES[]; 00052 static int NUM_MFF; 00053 00054 protected: 00055 ImageFormat* mImgFrmt; 00056 int mWidth; 00057 int mHeight; 00058 ImageState mState; 00059 InMemFormat *mMemFrmt; 00060 00061 template<class DType> 00062 unsigned char* scaleToUC( DType *data, 00063 double min, 00064 double max, 00065 int len ); 00066 00067 void makeRGBA( unsigned char* imbits, 00068 unsigned char* rData, 00069 unsigned char* gData, 00070 unsigned char* bData, 00071 int newWidth, 00072 int newHeight ); 00073 00074 00075 public: 00076 Image( ImageFormat * ); 00077 ~Image( ); 00078 00079 static Image* openImage( std::string fname, 00080 MultiFileType type=GENERIC ); 00081 00082 QImage* getRect( 00083 int x1, 00084 int y1, 00085 int w1, 00086 int h1, 00087 int w2, 00088 int h2, 00089 ImageFormat::ScaleType st = ImageFormat::SCALE_BI ); 00090 00091 int width( ); 00092 int height( ); 00093 00094 int width( int iband ); 00095 int height( int iband ); 00096 00097 std::vector<ImageFormat::BandInf>& getBandInfSet( ) const; 00098 std::string getName( ) const; 00099 00112 void getLL( double &x, double &y ); 00113 00127 void getXY( double &x, double &y ); 00128 00129 const ImageInf& getImageInf( ) { 00130 return mImgFrmt->getImageInf(); 00131 } 00132 00133 void setCornerPnts( int iband, ImageInf &inf ) { 00134 00135 00136 mImgFrmt->setCornerPnts( iband, inf ); 00137 } 00138 00139 void setCornerPnts( ImageInf &inf ) { 00140 mImgFrmt->setCornerPnts( mState.mRed, inf ); 00141 } 00142 00143 ImageState getImageState( ) { 00144 return mState; 00145 } 00146 void setImageState( ImageState &state ) { 00147 mState = state; 00148 if ( mMemFrmt ) 00149 mMemFrmt->stateToMem(); 00150 } 00151 00152 void setBandSel( ImageState &state ) { 00153 mState.mRed = state.mRed; 00154 mState.mGreen = state.mGreen; 00155 mState.mBlue = state.mBlue; 00156 00157 if ( mMemFrmt ) 00158 mMemFrmt->stateToMem(); 00159 } 00160 00161 void setMemBuf( bool state ); 00162 00163 ImageFormat* getFormat( ) { 00164 return mImgFrmt; 00165 } 00166 }; 00167 00168 #endif 00169 00170 00171 00172
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |