iipsrv  0.9.9
IIPImage.h
1 // IIPImage class
2 
3 /* IIP fcgi server module
4 
5  Copyright (C) 2000-2011 Ruven Pillay.
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 
22 
23 #ifndef _IIPIMAGE_H
24 #define _IIPIMAGE_H
25 
26 
27 // Fix missing snprintf in Windows
28 #if _MSC_VER
29 #define snprintf _snprintf
30 #endif
31 
32 
33 #include <string>
34 #include <list>
35 #include <vector>
36 #include <map>
37 
38 #include "RawTile.h"
39 
40 
41 
43 
48 class IIPImage {
49 
50  private:
51 
53  std::string imagePath;
54 
56  std::string fileSystemPrefix;
57 
59  std::string fileNamePattern;
60 
62  bool isFile;
63 
65  void testImageType();
66 
68  void measureHorizontalAngles();
69 
71  void measureVerticalAngles();
72 
74  std::list <int> horizontalAnglesList;
75 
77  std::list <int> verticalAnglesList;
78 
79 
80 
81  //protected:
82  public:
83 
85  std::string type;
86 
88  std::vector<unsigned int> image_widths, image_heights;
89 
91  unsigned int tile_width, tile_height;
92 
94  ColourSpaces colourspace;
95 
97  unsigned int numResolutions;
98 
100  unsigned int bpp;
101 
103  unsigned int channels;
104 
106  bool isSet;
107 
109  int currentX, currentY;
110 
112  std::map <const std::string, std::string> metadata;
113 
115  time_t timestamp;
116 
117 
118  public:
119 
121  IIPImage();
122 
124  IIPImage( const std::string& );
125 
127  IIPImage( const IIPImage& );
128 
130  virtual ~IIPImage() { ; };
131 
133  void Initialise();
134 
136  std::list <int> getVerticalViewsList(){ return verticalAnglesList; };
137 
139  std::list <int> getHorizontalViewsList(){ return horizontalAnglesList; };
140 
142  const std::string& getImagePath() { return imagePath; };
143 
145 
148  const std::string getFileName( int x, int y );
149 
151  const std::string& getImageType() { return type; };
152 
154  void updateTimestamp( const std::string& );
155 
157  const std::string getTimestamp();
158 
160  bool set() { return isSet; };
161 
163  void setFileSystemPrefix( const std::string& prefix ) { fileSystemPrefix = prefix; };
164 
166  void setFileNamePattern( const std::string& pattern ) { fileNamePattern = pattern; };
167 
170 
172  unsigned int getNumBitsPerPixel() { return bpp; };
173 
175  unsigned int getNumChannels() { return channels; };
176 
178 
180  unsigned int getImageWidth( int n=0) { return image_widths[n]; };
181 
183 
185  unsigned int getImageHeight( int n=0 ) { return image_heights[n]; };
186 
188 
189  unsigned int getTileHeight() { return tile_height; };
190 
192  unsigned int getTileWidth() { return tile_width; };
193 
195  ColourSpaces getColourSpace() { return colourspace; };
196 
198 
199  std::string getMetadata( const std::string& index ) {
200  return metadata[index];
201  };
202 
203 
204 
206 
209  virtual void Load( const std::string& module ) {;};
210 
212  virtual const std::string getDescription() { return std::string( "IIPImage Base Class" ); };
213 
215  virtual void openImage() { throw std::string( "IIPImage openImage called" ); };
216 
218 
221  virtual void loadImageInfo( int x, int y ) { ; };
222 
224  virtual void closeImage() {;};
225 
226 
228 
235  virtual RawTile getTile( int h, int v, unsigned int r, int l, unsigned int t ) { return RawTile(); };
236 
237 
239 
250  virtual void getRegion( int ha, int va, unsigned int r, int layers, int x, int y, unsigned int w, unsigned int h, unsigned char* b ){ return; };
251 
253  const IIPImage& operator = ( const IIPImage& );
254 
256  friend int operator == ( const IIPImage&, const IIPImage& );
257 
259  friend int operator != ( const IIPImage&, const IIPImage& );
260 
261 
262 };
263 
264 
265 
266 #endif