IIPImage.h

00001 // IIPImage class
00002 
00003 /*  IIP fcgi server module
00004 
00005     Copyright (C) 2000-2009 Ruven Pillay.
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 */
00021 
00022 
00023 #ifndef _IIPIMAGE_H
00024 #define _IIPIMAGE_H
00025 
00026 
00027 
00028 #include <string>
00029 #include <list>
00030 #include <vector>
00031 #include <map>
00032 
00033 #include "RawTile.h"
00034 
00035 
00036 
00038 
00043 class IIPImage {
00044 
00045  private:
00046 
00048   std::string imagePath; 
00049 
00051   std::string fileSystemPrefix;
00052 
00054   std::string fileNamePattern;
00055 
00057   bool isFile;
00058 
00060   void testImageType();
00061 
00063   void measureHorizontalAngles();
00064 
00066   void measureVerticalAngles();
00067 
00069   std::list <int> horizontalAnglesList;
00070 
00072   std::list <int> verticalAnglesList;
00073 
00074 
00075 
00076   //protected: 
00077   public:
00078 
00080   std::string type;
00081 
00083   std::vector<unsigned int> image_widths, image_heights;
00084 
00086   unsigned int tile_width, tile_height;
00087 
00089   ColourSpaces colourspace;
00090 
00092   int numResolutions;
00093 
00095   unsigned int bpp;
00096 
00098   unsigned int channels;
00099 
00101   bool isSet;
00102 
00104   int currentX, currentY;
00105 
00107   std::map <const std::string, std::string> metadata;
00108 
00110   time_t timestamp;
00111 
00112 
00113  public:
00114 
00116   IIPImage();
00117 
00119   IIPImage( const std::string& );
00120 
00122   IIPImage( const IIPImage& );
00123 
00125   virtual ~IIPImage() { ; };
00126 
00128   void Initialise();
00129 
00131   std::list <int> getVerticalViewsList(){ return verticalAnglesList; };
00132 
00134   std::list <int> getHorizontalViewsList(){ return horizontalAnglesList; };
00135 
00137   const std::string& getImagePath() { return imagePath; };
00138 
00140 
00143   const std::string getFileName( int x, int y );
00144 
00146   const std::string& getImageType() { return type; };
00147 
00149   void updateTimestamp( const std::string& );
00150 
00152   const std::string getTimestamp();
00153 
00155   bool set() { return isSet; };
00156 
00158   void setFileSystemPrefix( const std::string& prefix ) { fileSystemPrefix = prefix; };
00159 
00161   void setFileNamePattern( const std::string& pattern ) { fileNamePattern = pattern; };
00162 
00164   int getNumResolutions() { return numResolutions; };
00165 
00167   unsigned int getNumBitsPerPixel() { return bpp; };
00168 
00170   unsigned int getNumChannels() { return channels; };
00171 
00173 
00175   unsigned int getImageWidth( int n=0) { return image_widths[n]; };
00176 
00178 
00180   unsigned int getImageHeight( int n=0 ) { return image_heights[n]; };
00181 
00183 
00184   unsigned int getTileHeight() { return tile_height; };
00185 
00187   unsigned int getTileWidth() { return tile_width; };
00188 
00190   ColourSpaces getColourSpace() { return colourspace; };
00191 
00193 
00194   std::string getMetadata( const std::string& index ) {
00195     return metadata[index];
00196   };
00197 
00198 
00199 
00201 
00204   virtual void Load( const std::string& module ) {;};
00205 
00207   virtual const std::string getDescription() { return std::string( "IIPImage Base Class" ); };
00208 
00210   virtual void openImage() { throw std::string( "IIPImage openImage called" ); };
00211 
00213 
00216   virtual void loadImageInfo( int x, int y ) { ; };
00217 
00219   virtual void closeImage() {;};
00220 
00221 
00223 
00230   virtual RawTile getTile( int h, int v, unsigned int r, int l, unsigned int t ) { return RawTile(); };
00231 
00232 
00234 
00245     virtual void getRegion( int ha, int va, unsigned int r, int layers, int x, int y, int w, int h, unsigned char* b ){ return; };
00246 
00248   const IIPImage& operator = ( const IIPImage& );
00249 
00251   friend int operator == ( const IIPImage&, const IIPImage& );
00252 
00254   friend int operator != ( const IIPImage&, const IIPImage& );
00255 
00256 
00257 };
00258 
00259 
00260 
00261 #endif

Generated on Fri Nov 26 16:55:07 2010 for iipsrv by  doxygen 1.5.8