svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / base / lti_rawImageReader.h @ 12250
History | View | Annotate | Download (8.12 KB)
1 |
/* $Id: lti_rawImageReader.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 LTIRAWIMAGEREADER_H
|
14 |
#define LTIRAWIMAGEREADER_H
|
15 |
|
16 |
// lt_lib_mrsid_core
|
17 |
#include "lti_imageReader.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 LTIPixel; |
27 |
class LTIOStreamInf; |
28 |
class LTFileSpec; |
29 |
class LTIGeoCoord; |
30 |
class LTIPixel; |
31 |
|
32 |
|
33 |
/**
|
34 |
* class for reading RAW files
|
35 |
*
|
36 |
* This class reads a RAW image.
|
37 |
*
|
38 |
* The RAW format used is simple packed BIP form.
|
39 |
*/
|
40 |
class LTIRawImageReader : public LTIImageReader |
41 |
{ |
42 |
public:
|
43 |
/**
|
44 |
* constructor (stream)
|
45 |
*
|
46 |
* This function constructs an LTIImageReader using the data in the
|
47 |
* stream with the image properties specified. The input taken from a
|
48 |
* stream.
|
49 |
*
|
50 |
* @param stream stream containing the RAW image data (may not be NULL)
|
51 |
* @param pixelProps the pixel properties of the image (colorspace, datatype, etc)
|
52 |
* @param width the width of the image
|
53 |
* @param height the height of the image
|
54 |
*/
|
55 |
LTIRawImageReader(LTIOStreamInf* stream, |
56 |
const LTIPixel& pixelProps,
|
57 |
lt_uint32 width, |
58 |
lt_uint32 height); |
59 |
|
60 |
/**
|
61 |
* constructor (FileSpec)
|
62 |
*
|
63 |
* This function constructs an LTIImageReader using the data in the
|
64 |
* stream with the image properties specified. The input taken from a
|
65 |
* stream, and the background and nodata pixels may be specified.
|
66 |
*
|
67 |
* @param fileSpec file containing the RAW image data
|
68 |
* @param pixelProps the pixel properties of the image (colorspace, datatype, etc)
|
69 |
* @param width the width of the image
|
70 |
* @param height the height of the image
|
71 |
*/
|
72 |
LTIRawImageReader(const LTFileSpec& fileSpec,
|
73 |
const LTIPixel& pixelProps,
|
74 |
lt_uint32 width, |
75 |
lt_uint32 height); |
76 |
|
77 |
/**
|
78 |
* constructor (char*)
|
79 |
*
|
80 |
* This function constructs an LTIImageReader using the data in the
|
81 |
* stream with the image properties specified. The input taken from a
|
82 |
* stream, and the background and nodata pixels may be specified.
|
83 |
*
|
84 |
* @param file file containing the RAW image data (may not be NULL)
|
85 |
* @param pixelProps the pixel properties of the image (colorspace, datatype, etc)
|
86 |
* @param width the width of the image
|
87 |
* @param height the height of the image
|
88 |
*/
|
89 |
LTIRawImageReader(const char* file, |
90 |
const LTIPixel& pixelProps,
|
91 |
lt_uint32 width, |
92 |
lt_uint32 height); |
93 |
|
94 |
/**
|
95 |
* destructor
|
96 |
*/
|
97 |
virtual ~LTIRawImageReader(); |
98 |
|
99 |
/**
|
100 |
* initializer
|
101 |
*/
|
102 |
virtual LT_STATUS initialize(); |
103 |
|
104 |
|
105 |
/**
|
106 |
* @name Properties of the RAW image
|
107 |
*
|
108 |
* These must be called prior to calling initialize(), unlike most other SDK
|
109 |
* objects.
|
110 |
*/
|
111 |
/*@{*/
|
112 |
|
113 |
/**
|
114 |
* set geo coordinates
|
115 |
*
|
116 |
* Sets the geographic coordinates for the image. If not set, the default
|
117 |
* is the normal default of (0,h-1) with resolutions (1.0,-1.0).
|
118 |
*
|
119 |
* @note This must be called prior to calling initialize().
|
120 |
*
|
121 |
* @param geo the geo coordinates for the image
|
122 |
*/
|
123 |
void setGeoCoordinate(const LTIGeoCoord& geo); |
124 |
|
125 |
/**
|
126 |
* set stream ownership
|
127 |
*
|
128 |
* Sets the ownership of the stream, to indicate responsibility for
|
129 |
* deleting the stream when done. This only pertains to objects which were
|
130 |
* passed a stream in the ctor.
|
131 |
*
|
132 |
* If not set, the default is for the object to not take ownership of the
|
133 |
* stream.
|
134 |
*
|
135 |
* @note This must be called prior to calling initialize().
|
136 |
*
|
137 |
* @param takeOwnership set to true to have the reader delete the stream
|
138 |
*/
|
139 |
void setStreamOwnership(bool takeOwnership); |
140 |
|
141 |
/**
|
142 |
* add classical metadata
|
143 |
*
|
144 |
* Directs the reader to populate the standard "classical" metadata tags.
|
145 |
*
|
146 |
* If not set, the default is to not add the metadata tags.
|
147 |
*
|
148 |
* @note This must be called prior to calling initialize().
|
149 |
*
|
150 |
* @param withMetadata set to true to have the reader add metadata
|
151 |
*/
|
152 |
void setMetadata(bool withMetadata); |
153 |
|
154 |
/**
|
155 |
* set background color
|
156 |
*
|
157 |
* Sets the background pixel of the image.
|
158 |
*
|
159 |
* If not set, the default is to leave the background pixel unset.
|
160 |
*
|
161 |
* @note This must be called prior to calling initialize().
|
162 |
*
|
163 |
* @param background the new background color of the image
|
164 |
*/
|
165 |
void setBackground(const LTIPixel* background); |
166 |
|
167 |
/**
|
168 |
* set nodata color
|
169 |
*
|
170 |
* Sets the NoData pixel of the image.
|
171 |
*
|
172 |
* If not set, the default is to leave the NoData pixel unset.
|
173 |
*
|
174 |
* @note This must be called prior to calling initialize().
|
175 |
*
|
176 |
* @param nodata the new nodata color of the image
|
177 |
*/
|
178 |
void setNoData(const LTIPixel* nodata); |
179 |
|
180 |
/**
|
181 |
* sets the number of bytes in each row
|
182 |
*
|
183 |
* Sets the number of bytes in each row. This allows for alignment
|
184 |
* padding, required by certain RAW formats.
|
185 |
*
|
186 |
* If not set, the bytes per row is simply the number of data items per
|
187 |
* row times the size of a data item. (Note that a "data item" in this
|
188 |
* case may be either a pixel or a sample, depending on the layout being
|
189 |
* used.)
|
190 |
*
|
191 |
* @note This must be called prior to calling initialize().
|
192 |
*
|
193 |
* @param rowBytes the number of bytes per row
|
194 |
*/
|
195 |
void setRowBytes(lt_uint32 rowBytes);
|
196 |
|
197 |
/**
|
198 |
* sets the layout or organization of the raw data
|
199 |
*
|
200 |
* Sets the layout or organization of the raw data.
|
201 |
*
|
202 |
* If not set, the default is BIP format.
|
203 |
*
|
204 |
* @note This must be called prior to calling initialize().
|
205 |
*
|
206 |
* @param layout the layout of the raw data
|
207 |
*/
|
208 |
void setLayout(LTILayout layout);
|
209 |
|
210 |
/**
|
211 |
* sets the number of bytes to skip at the beginning of the file
|
212 |
*
|
213 |
* Sets the number of bytes to skip at the beginning of the file. If not
|
214 |
* set, the default is zero (no leading bytes are skipped).
|
215 |
*
|
216 |
* @note This must be called prior to calling initialize().
|
217 |
*
|
218 |
* @param skipBytes the number of bytes to skip
|
219 |
*/
|
220 |
void setSkipBytes(lt_uint32 skipBytes);
|
221 |
|
222 |
/**
|
223 |
* sets endianness of output file
|
224 |
*
|
225 |
* Sets the byte order or endianness of the output file.
|
226 |
*
|
227 |
* @note This must be called prior to calling initialize().
|
228 |
*
|
229 |
* @param byteOrder the endian setting to use
|
230 |
*/
|
231 |
void setByteOrder(LTIEndian byteOrder);
|
232 |
|
233 |
/*@}*/
|
234 |
|
235 |
virtual LTIImageReader* duplicate(); |
236 |
|
237 |
virtual lt_int64 getPhysicalFileSize() const;
|
238 |
|
239 |
protected:
|
240 |
LTIRawImageReader(const LTFileSpec& fileSpec);
|
241 |
void setCtorPixelProps(const LTIPixel& pixelProps); |
242 |
void setCtorDimensions(lt_uint32 width, lt_uint32 height);
|
243 |
|
244 |
virtual LT_STATUS decodeStrip(LTISceneBuffer& stripBuffer, const LTIScene& stripScene);
|
245 |
virtual LT_STATUS decodeBegin(const LTIScene& scene);
|
246 |
virtual LT_STATUS decodeEnd(); |
247 |
|
248 |
LTFileSpec* m_fileSpec; |
249 |
|
250 |
private:
|
251 |
LTIOStreamInf* m_stream; |
252 |
bool m_ownsStream;
|
253 |
LTIPixel* m_pixel; |
254 |
lt_uint32 m_width; |
255 |
lt_uint32 m_height; |
256 |
const LTIGeoCoord* m_geoCoordArg;
|
257 |
lt_int64 m_fileSize; |
258 |
bool m_withMetadata;
|
259 |
lt_uint32 m_rowBytes; |
260 |
LTILayout m_layout; |
261 |
lt_uint32 m_skipBytes; |
262 |
LTIEndian m_byteOrder; |
263 |
|
264 |
lt_uint8* m_rowBuffer; |
265 |
|
266 |
const LTIPixel* m_backgroundPixel;
|
267 |
const LTIPixel* m_nodataPixel;
|
268 |
|
269 |
// nope
|
270 |
LTIRawImageReader(LTIRawImageReader&); |
271 |
LTIRawImageReader& operator=(const LTIRawImageReader&);
|
272 |
}; |
273 |
|
274 |
|
275 |
LT_END_NAMESPACE(LizardTech) |
276 |
|
277 |
#if defined(LT_COMPILER_MS)
|
278 |
#pragma warning(pop)
|
279 |
#endif
|
280 |
|
281 |
#endif // LTIRAWIMAGEREADER_H |