00001 #ifndef __IMAGEFORMAT_H 00002 #define __IMAGEFORMAT_H 00003 00004 #include "windows_defs.h" 00005 00006 #include <string> 00007 #include <vector> 00008 #include <proj_api.h> 00009 00010 #include "imageinf.h" 00011 00012 #ifndef M_PI 00013 #define M_PI 3.1415926 00014 #endif 00015 00037 class GV_EXPORT ImageFormat { 00038 public: 00039 typedef enum { 00040 SCALE_NN = 1, 00041 SCALE_BI, 00042 SCALE_BC 00043 } ScaleType; 00044 00045 typedef enum { 00046 NOT_DEFINED, 00047 INT8, 00048 UINT8, 00049 INT16, 00050 UINT16, 00051 INT32, 00052 UINT32, 00053 INT64, 00054 UINT64, 00055 FLOAT16, 00056 FLOAT32, 00057 FLOAT64 00058 } DataType; 00059 00063 typedef struct { 00064 int width; 00065 int height; 00066 DataType type; 00067 std::string name; 00068 double res; 00069 double swlen; 00070 double ewlen; 00071 double max; 00072 double min; 00073 int ndims; 00074 std::string proj; 00075 int UTMZ; 00076 std::vector<std::string> parms; 00077 double rot; 00078 double ulx; 00079 double uly; 00080 } BandInf; 00081 00082 private: 00083 char *mParms[15]; 00084 00085 protected: 00086 std::string mFName; 00087 std::vector<BandInf> mBandSet; 00088 ImageInf mImageInf; 00089 00090 void xyToLL( int iband, double &x, double &y ); 00091 void xyToMeter( int iband, double &x, double &y ); 00092 void meterToLL( int iband, double &x, double &y ); 00093 void llToMeter( int iband, double &lon, double &lat ); 00094 void llToXY( int iband, double &lon, double &lat ); 00095 projPJ createProj( int iband ); 00096 void getULCorners( ); 00097 00098 public: 00099 ImageFormat( ); 00100 virtual ~ImageFormat( ); 00101 00102 virtual bool open( std::string fname ) =0; 00103 virtual void* getBand( int iband, 00104 int x1, 00105 int y1, 00106 int w1, 00107 int h1, 00108 int w2, 00109 int h2, 00110 ScaleType st = SCALE_BI ) const =0; 00111 00112 virtual void getLL( int iband, 00113 double &i, 00114 double &j ) =0; 00115 00116 virtual void getXY( int iband, 00117 double &i, 00118 double &j ) =0; 00119 00120 00121 // void getImageInf( GlimsDataset::ImageInf &imginf ); 00122 std::vector<BandInf>& getBandInfSet( ); 00123 unsigned int getNumBands( ) { 00124 return mBandSet.size(); 00125 } 00126 const BandInf& getBandInf( int iband ); 00127 std::string getName( ) const; 00128 00129 static std::string dtypeToString( DataType dt ); 00130 static int dtypeSize( DataType dt ); 00131 static bool isFloat( DataType dt ); 00132 00133 // 8 BIT IMAGE SCALING ROUTINES 00134 char* scaleData( char **orig, 00135 int ow, 00136 int oh, 00137 int nw, 00138 int nh, 00139 DataType dt, 00140 ScaleType st, 00141 bool del = true ) const; 00142 00143 char* scaleData( char **orig, 00144 int ox, 00145 int oy, 00146 int ow, 00147 int oh, 00148 int fw, 00149 int fh, 00150 int nw, 00151 int nh, 00152 DataType dt, 00153 ScaleType st, 00154 bool del = true ) const; 00155 00156 template<class DType> DType* 00157 scaleDT( DType* orig, 00158 int ox, 00159 int oy, 00160 int ow, 00161 int oh, 00162 int fw, 00163 int fh, 00164 int nw, 00165 int nh, 00166 ScaleType st ) const; 00167 00168 template<typename DType> DType* 00169 scl_nearestneighbor( DType* orig, 00170 int ox, 00171 int oy, 00172 int ow, 00173 int oh, 00174 int fw, 00175 int fh, 00176 int nw, 00177 int nh ) const; 00178 00179 template<class DType> DType* 00180 scl_bilinear( DType* orig, 00181 int ox, 00182 int oy, 00183 int ow, 00184 int oh, 00185 int fw, 00186 int fh, 00187 int nw, 00188 int nh ) const; 00189 00190 unsigned char* scl_bicubic( unsigned char* orig, 00191 int ow, 00192 int oh, 00193 int nw, 00194 int nh, 00195 int szd ) const; 00196 00197 ImageInf& getImageInf( ) { 00198 return mImageInf; 00199 } 00200 00201 void setCornerPnts( int iband, ImageInf &inf ); 00202 }; 00203 00204 #endif 00205 00206 00207 00208
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |