svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / mrsid_readers / MG3CompositeImageReader.h @ 3539
History | View | Annotate | Download (8.86 KB)
1 |
/* $Id: MG3CompositeImageReader.h 3539 2006-01-09 12:23:20Z nacho $ */
|
---|---|
2 |
/* //////////////////////////////////////////////////////////////////////////
|
3 |
// //
|
4 |
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
|
5 |
// Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
|
6 |
// prohibited. Access to and use of this code is permitted only under //
|
7 |
// license from LizardTech, Inc. Portions of the code are protected by //
|
8 |
// US and foreign patents and other filings. All Rights Reserved. //
|
9 |
// //
|
10 |
////////////////////////////////////////////////////////////////////////// */
|
11 |
/* PUBLIC */
|
12 |
|
13 |
#ifndef MG3COMPOSITEIMAGEREADER_H
|
14 |
#define MG3COMPOSITEIMAGEREADER_H
|
15 |
|
16 |
// lt_lib_mrsid_mrsidReaders
|
17 |
#include "MrSIDImageReaderBase.h" |
18 |
|
19 |
|
20 |
LT_BEGIN_NAMESPACE(LizardTech) |
21 |
|
22 |
#if defined(LT_COMPILER_MS)
|
23 |
#pragma warning(push,4) |
24 |
#endif
|
25 |
|
26 |
class MG3Container; |
27 |
class LTIMosaicFilter; |
28 |
class MG3SingleImageReader; |
29 |
class MG2ImageReader; |
30 |
class J2KImageReader; |
31 |
|
32 |
/**
|
33 |
* reader for MrSID/MG3 images
|
34 |
*
|
35 |
* This class supports reading MrSID/MG3 images.
|
36 |
*
|
37 |
* @note MrSID/MG2 images are not supported with this class.
|
38 |
*/
|
39 |
class MG3CompositeImageReader : public MrSIDImageReaderBase |
40 |
{ |
41 |
public:
|
42 |
/**
|
43 |
* constructor
|
44 |
*
|
45 |
* Create an MG3 reader from the given file.
|
46 |
*
|
47 |
* The \a imageNumber array allows for control over
|
48 |
* which tiles in the image should be opened to form
|
49 |
* the composite (mosaic) image. If NULL is passed,
|
50 |
* all tiles will be used.
|
51 |
*
|
52 |
* To determine the tiles available in the image,
|
53 |
* you can use the static getCompositeImageInfo()
|
54 |
* member function.
|
55 |
*
|
56 |
* @param fileSpec file containing MrSID image
|
57 |
* @param imageNumber array of image tile numbers
|
58 |
* @param numImages size of \a imageNumber array
|
59 |
* @param useWorldFile incorporate world file data when reading image
|
60 |
* @param memoryUsage control memory resource usage
|
61 |
* @param streamUsage control stream resource usage
|
62 |
*/
|
63 |
MG3CompositeImageReader(const LTFileSpec& fileSpec,
|
64 |
const lt_uint32* imageNumber,
|
65 |
lt_uint32 numImages, |
66 |
bool useWorldFile,
|
67 |
MrSIDMemoryUsage memoryUsage, |
68 |
MrSIDStreamUsage streamUsage); |
69 |
|
70 |
/**
|
71 |
* constructor
|
72 |
*
|
73 |
* Construct an MG3 image from a stream. (See file-based
|
74 |
* constructor for details.)
|
75 |
*
|
76 |
* @param stream stream containing MrSID image (may not be NULL)
|
77 |
* @param imageNumber array of image tile numbers
|
78 |
* @param numImages size of \a imageNumber array
|
79 |
* @param worldFileStream stream containing world file data (may be NULL)
|
80 |
* @param memoryUsage control memory resource usage
|
81 |
* @param streamUsage control stream resource usage
|
82 |
*/
|
83 |
MG3CompositeImageReader(LTIOStreamInf* stream, |
84 |
const lt_uint32* imageNumber,
|
85 |
lt_uint32 numImages, |
86 |
LTIOStreamInf* worldFileStream, |
87 |
MrSIDMemoryUsage memoryUsage, |
88 |
MrSIDStreamUsage streamUsage); |
89 |
|
90 |
MG3CompositeImageReader(MG3Container* container, |
91 |
const lt_uint32* imageNumber,
|
92 |
lt_uint32 numImages, |
93 |
LTIOStreamInf* worldFileStream, |
94 |
MrSIDMemoryUsage memoryUsage, |
95 |
MrSIDStreamUsage streamUsage); |
96 |
|
97 |
virtual ~MG3CompositeImageReader(); |
98 |
LT_STATUS initialize(); |
99 |
|
100 |
LT_STATUS setStripHeight(lt_uint32 stripHeight); |
101 |
lt_uint32 getStripHeight() const;
|
102 |
|
103 |
lt_uint8 getNumLevels() const;
|
104 |
bool isLocked() const; |
105 |
|
106 |
void getVersion(lt_uint8& major, lt_uint8& minor, lt_uint8& tweak, char& letter) const; |
107 |
|
108 |
/**
|
109 |
* query if is optimizable
|
110 |
*
|
111 |
* Returns true if and only if the image can be further compressed.
|
112 |
*
|
113 |
* @return true, if and only if the image may be compressed
|
114 |
*/
|
115 |
bool isOptimizable() const; |
116 |
|
117 |
/**
|
118 |
* tile type queries
|
119 |
*
|
120 |
* These functions are used to determine whether any of the tiles
|
121 |
* in the image are MG2 or JPEG 2000.
|
122 |
*/
|
123 |
/*@{*/
|
124 |
bool hasMG2Data() const; |
125 |
bool hasJP2Data() const; |
126 |
/*@}*/
|
127 |
|
128 |
void setInterruptDelegate(LTIInterruptDelegate* delegate);
|
129 |
|
130 |
lt_int64 getPhysicalFileSize() const;
|
131 |
|
132 |
/**
|
133 |
* file format type of image tile
|
134 |
*/
|
135 |
enum CompositeImageType
|
136 |
{ |
137 |
COMPOSITETYPE_MG2 = 1,
|
138 |
COMPOSITETYPE_MG3 = 2,
|
139 |
COMPOSITETYPE_JP2 = 3
|
140 |
}; |
141 |
|
142 |
/**
|
143 |
* structure representing tiled image
|
144 |
*/
|
145 |
struct CompositeImageInfo
|
146 |
{ |
147 |
/** image tile number */
|
148 |
lt_uint32 imageId; |
149 |
|
150 |
/** x-position of tile in the mosaic */
|
151 |
double xPos;
|
152 |
|
153 |
/** y-position of tile in the mosaic */
|
154 |
double yPos;
|
155 |
|
156 |
/** type of image tile */
|
157 |
CompositeImageType imageType; |
158 |
}; |
159 |
|
160 |
/**
|
161 |
* query tile information
|
162 |
*
|
163 |
* This function is used to collect information about the tiles in the
|
164 |
* image.
|
165 |
*
|
166 |
* The caller takes ownership of the returned \a tileInfo array.
|
167 |
*
|
168 |
* @param tileInfo array of tile information structures to be set
|
169 |
* @param numTiles number of tiles
|
170 |
* @return status code indicating success or failure
|
171 |
*/
|
172 |
LT_STATUS getTileInfo(CompositeImageInfo *&tileInfo, lt_uint32 &numTiles) const;
|
173 |
|
174 |
/**
|
175 |
* query tile information
|
176 |
*
|
177 |
* This function is used to collect information about the tiles in
|
178 |
* the image contained in the given file.
|
179 |
*
|
180 |
* The caller takes ownership of the returned \a info array.
|
181 |
*
|
182 |
* @param fileSpec name of image to query
|
183 |
* @param tileInfo array of tile information structures to be set
|
184 |
* @param numTiles number of tiles
|
185 |
* @return status code indicating success or failure
|
186 |
*/
|
187 |
static LT_STATUS getCompositeImageInfo(const LTFileSpec &fileSpec, |
188 |
CompositeImageInfo *&tileInfo, |
189 |
lt_uint32 &numTiles); |
190 |
|
191 |
/**
|
192 |
* query tile information
|
193 |
*
|
194 |
* This function is used to collect information about the tiles in
|
195 |
* the image contained in the given stream.
|
196 |
*
|
197 |
* The caller takes ownership of the returned \a info array.
|
198 |
*
|
199 |
* @param stream stream containing image to query
|
200 |
* @param tileInfo array of tile information structures to be set
|
201 |
* @param numTiles number of tiles
|
202 |
* @return status code indicating success or failure
|
203 |
*/
|
204 |
static LT_STATUS getCompositeImageInfo(LTIOStreamInf &stream,
|
205 |
CompositeImageInfo *&tileInfo, |
206 |
lt_uint32 &numTiles); |
207 |
|
208 |
static LT_STATUS getCompositeImageInfo(const MG3Container &container, |
209 |
CompositeImageInfo *&tileInfo, |
210 |
lt_uint32 &numTiles); |
211 |
|
212 |
|
213 |
//protected: // only used be MG3Optimizer
|
214 |
bool getReaderScene(lt_uint32 imageIndex,
|
215 |
const LTIScene &scene,
|
216 |
LTIScene &readerScene) const;
|
217 |
|
218 |
protected:
|
219 |
LT_STATUS decodeBegin(const LTIScene& scene);
|
220 |
LT_STATUS decodeStrip(LTISceneBuffer& stripBuffer, |
221 |
const LTIScene& stripScene);
|
222 |
LT_STATUS decodeEnd(); |
223 |
|
224 |
LT_STATUS init(void);
|
225 |
|
226 |
virtual LT_STATUS createMG2Reader(lt_uint32 imageNumber, |
227 |
MG2ImageReader *&mg2Reader); |
228 |
virtual LT_STATUS createMG3Reader(lt_uint32 imageNumber, |
229 |
MG3SingleImageReader *&mg3Reader); |
230 |
virtual LT_STATUS createJP2Reader(lt_uint32 imageNumber, |
231 |
J2KImageReader *&jp2Reader); |
232 |
|
233 |
virtual LT_STATUS updateMemoryModel(); |
234 |
|
235 |
#ifndef DOXYGEN_EXCLUDE
|
236 |
struct Data
|
237 |
{ |
238 |
~Data(void);
|
239 |
Data(const LTFileSpec *fileSpec,
|
240 |
LTIOStreamInf *stream, |
241 |
MG3Container* container, |
242 |
lt_uint32 numImages, |
243 |
const lt_uint32* imageNumbers,
|
244 |
LTIOStreamInf* worldFileStream); |
245 |
|
246 |
MG3Container* m_container; |
247 |
bool m_ownContainer;
|
248 |
|
249 |
lt_uint32 m_numImages; |
250 |
lt_uint32* m_imageNumbers; |
251 |
LTIImageReader** m_readers; |
252 |
LTIImageStage** m_images; |
253 |
CompositeImageType *m_tileType; |
254 |
LTIMosaicFilter* m_mosaic; |
255 |
|
256 |
LTFileSpec* m_fileSpec; |
257 |
LTIOStreamInf* m_stream; |
258 |
bool m_ownStream;
|
259 |
LTIOStreamInf* m_worldFileStream; |
260 |
|
261 |
bool m_isLockedComposite;
|
262 |
lt_uint8 m_numLevelsComposite; |
263 |
bool m_isOptimizableComposite;
|
264 |
bool m_hasMG2Composite;
|
265 |
bool m_hasJP2Composite;
|
266 |
}; |
267 |
#endif
|
268 |
Data *m_dat; |
269 |
|
270 |
private:
|
271 |
typedef MrSIDImageReaderBase Super;
|
272 |
|
273 |
// nope
|
274 |
MG3CompositeImageReader(const MG3CompositeImageReader&);
|
275 |
MG3CompositeImageReader& operator=(const MG3CompositeImageReader&);
|
276 |
}; |
277 |
|
278 |
|
279 |
LT_END_NAMESPACE(LizardTech) |
280 |
|
281 |
#if defined(LT_COMPILER_MS)
|
282 |
#pragma warning(pop)
|
283 |
#endif
|
284 |
|
285 |
#endif // MG3COMPOSITEIMAGEREADER_H |