Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

PhxEcw.h

00001 #ifndef PHX_ECW_H
00002 #define PHX_ECW_H
00003 
00004 #include <string>
00005 #include <inttypes.h>
00006 #include <NCSECWClient.h>
00007 #include <NCSFile.h>
00008 #include <NCSErrors.h>
00009 #include <Phx/Util/PhxBuffer.h>
00010 
00011 namespace Phx {
00012 
00013 
00014   /* -----------------------------------------------------
00015    * |                  Decompressors                    |
00016    * -----------------------------------------------------
00017    */
00018   class EcwHeightDecompressor {
00019   public:
00020     typedef int16_t CellType;
00021 
00022     EcwHeightDecompressor(const std::string& fileName);
00023     virtual ~EcwHeightDecompressor();
00024 
00025     static uint32_t  bandCount()  { return 1; }
00026     uint32_t  width() const { return mWidth; }
00027     uint32_t  height() const { return mHeight; }
00028 
00029     // Returns an imgSizeX*imgSizeY*bandCount() buffer of cell values
00030     // or 0 if imgSizeX or imgSizeY is too small.  Returned buffer must
00031     // be delete[]'d by caller.
00032     Ptr<Buffer<CellType> > image(uint32_t tlx, uint32_t tly,
00033                                  uint32_t brx, uint32_t bry,
00034                                  uint32_t imgSizeX, uint32_t imgSizeY);
00035 
00036   private:
00037     // do not use.
00038     EcwHeightDecompressor(EcwHeightDecompressor&);
00039     EcwHeightDecompressor& operator=(EcwHeightDecompressor&);
00040 
00041     // libECW structures
00042     NCSFileView*  mFileView;
00043     uint32_t mWidth, mHeight;
00044   };
00045 
00046   class EcwGrayDecompressor {
00047   public:
00048     typedef uint8_t CellType;
00049 
00050     EcwGrayDecompressor(const std::string& fileName);
00051     virtual ~EcwGrayDecompressor();
00052 
00053     static uint32_t  bandCount() { return 1; }
00054     uint32_t  width() const { return mWidth; }
00055     uint32_t  height() const { return mHeight; }
00056 
00057     // Returns an imgSizeX*imgSizeY*bandCount() buffer of cell values
00058     // or 0 if imgSizeX or imgSizeY is too small.  Client must
00059     // delete[] buffer when finished.
00060     Ptr<Buffer<CellType> > image(uint32_t tlx, uint32_t tly,
00061                                  uint32_t brx, uint32_t bry,
00062                                  uint32_t imgSizeX, uint32_t imgSizeY);
00063   private:
00064     // do not use.
00065     EcwGrayDecompressor(EcwGrayDecompressor&);
00066     EcwGrayDecompressor& operator=(EcwGrayDecompressor&);
00067 
00068     // libECW structures
00069     NCSFileView*  mFileView;
00070     uint32_t mWidth, mHeight;
00071   };
00072 
00073   class EcwRgbDecompressor {
00074   public:
00075     typedef uint8_t CellType;
00076 
00077     EcwRgbDecompressor(const std::string& fileName);
00078     virtual ~EcwRgbDecompressor();
00079 
00080     static uint32_t  bandCount() { return 3; }
00081     uint32_t  width() const { return mWidth; }
00082     uint32_t  height() const { return mHeight; }
00083 
00084     // Returns an imgSizeX*imgSizeY*bandCount() buffer of cell values
00085     // or 0 if imgSizeX or imgSizeY is too small.  Client must
00086     // delete[] buffer when finished.
00087     Ptr<Buffer<CellType> > image(uint32_t tlx, uint32_t tly,
00088                                  uint32_t brx, uint32_t bry,
00089                                  uint32_t imgSizeX, uint32_t imgSizeY);
00090   private:
00091     // do not use.
00092     EcwRgbDecompressor(EcwRgbDecompressor&);
00093     EcwRgbDecompressor& operator=(EcwRgbDecompressor&);
00094 
00095     // libECW structures
00096     NCSFileView*  mFileView;
00097     uint32_t mWidth, mHeight;
00098   };
00099 
00100 
00101   /* -----------------------------------------------------
00102    * |                    Compressors                    |
00103    * -----------------------------------------------------
00104    */
00105   class EcwHeightCompressor {
00106   public:
00107     typedef int16_t CellType;
00108     // static const CellType MAX_CELL_VALUE;
00109     // static const CellType MIN_CELL_VALUE;
00110     EcwHeightCompressor(const std::string& fileName,
00111                         uint32_t width, uint32_t height);
00112     virtual ~EcwHeightCompressor();
00113     static uint32_t bandCount() { return 1; }
00114 
00115     // Callback listener to retrieve scanlines.
00116     class ImageListener {
00117     public:
00118       virtual ~ImageListener(){}
00119       virtual void scanline(uint32_t width, uint32_t y,
00120                             CellType* scanline) = 0;
00121     };
00122 
00129     void image(const CellType* image);
00130 
00135     void imageCallback(ImageListener* listener);
00136 
00137     uint32_t width() const { return mWidth; }
00138     uint32_t height() const { return mHeight; }
00139 
00140   private:
00141     // do not use.
00142     EcwHeightCompressor(EcwHeightCompressor&);
00143     EcwHeightCompressor& operator=(EcwHeightCompressor&);
00144 
00145     uint32_t     mWidth, mHeight;
00146     std::string  mFileName;
00147   };
00148 
00149 
00150   class EcwRgbCompressor {
00151   public:
00152     typedef uint8_t CellType;
00153 
00154     EcwRgbCompressor(const std::string& fileName,
00155                      uint32_t width, uint32_t height);
00156     virtual ~EcwRgbCompressor();
00157     static uint32_t  bandCount() { return 3; }
00158 
00159     // Callback listener to retrieve scanlines.
00160     class ImageListener {
00161     public:
00162       virtual ~ImageListener() {}
00163       virtual void scanline(uint32_t width, uint32_t y,
00164                             CellType* scanline) = 0;
00165     };
00166 
00173     void image(const CellType* image);
00174 
00179     void imageCallback(ImageListener* listener);
00180 
00181     uint32_t width() const { return mWidth; }
00182     uint32_t height() const { return mHeight; }
00183 
00184   private:
00185     // do not use.
00186     EcwRgbCompressor(EcwRgbCompressor&);
00187     EcwRgbCompressor& operator=(EcwRgbCompressor&);
00188 
00189     uint32_t     mWidth, mHeight;
00190     std::string  mFileName;
00191   };
00192 
00193 
00194 };
00195 
00196 
00197 #endif /* PHX_ECW_H */
00198 

Generated on Mon Jul 10 19:45:28 2006 for Phoenix OSFS by  doxygen 1.4.2