00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef I2DBMPS_H
00030 #define I2DBMPS_H
00031
00032 #include "dcmtk/config/osconfig.h"
00033 #include "dcmtk/dcmdata/libi2d/i2dimgs.h"
00034 #include "dcmtk/ofstd/offile.h"
00035
00039 class I2DBmpSource : public I2DImgSource
00040 {
00041
00042 public:
00043
00047 I2DBmpSource();
00048
00052 OFString inputFormat() const;
00053
00077 OFCondition readPixelData( Uint16& rows,
00078 Uint16& cols,
00079 Uint16& samplesPerPixel,
00080 OFString& photoMetrInt,
00081 Uint16& bitsAlloc,
00082 Uint16& bitsStored,
00083 Uint16& highBit,
00084 Uint16& pixelRepr,
00085 Uint16& planConf,
00086 Uint16& pixAspectH,
00087 Uint16& pixAspectV,
00088 char*& pixData,
00089 Uint32& length,
00090 E_TransferSyntax& ts);
00091
00101 virtual OFCondition getLossyComprInfo(OFBool& srcEncodingLossy,
00102 OFString& ) const
00103 {
00104 srcEncodingLossy = OFFalse;
00105 return EC_Normal;
00106 }
00107
00111 virtual ~I2DBmpSource();
00112
00113 protected:
00114
00119 OFCondition openFile(const OFString& filename);
00120
00124 void closeFile();
00125
00130 OFCondition readFileHeader(Uint32 &offset);
00131
00143 OFCondition readBitmapHeader(Uint16 &width ,
00144 Uint16 &height ,
00145 Uint16 &bpp ,
00146 OFBool &isTopDown ,
00147 Uint16 &colors );
00148
00154 OFCondition readColorPalette(Uint16 colors,
00155 Uint32*& palette);
00156
00169 OFCondition readBitmapData(const Uint16 width,
00170 const Uint16 height,
00171 const Uint16 bpp,
00172 const OFBool isTopDown,
00173 const Uint16 colors,
00174 const Uint32* palette,
00175 char*& pixData ,
00176 Uint32& length );
00177
00185 OFCondition parse24_32BppRow(const Uint8 *row,
00186 const Uint16 width,
00187 const int bpp,
00188 char *pixData ) const;
00189
00196 OFCondition parse16BppRow(const Uint8 *row,
00197 const Uint16 width,
00198 char *pixData ) const;
00199
00209 OFCondition parseIndexedColorRow(const Uint8 *row,
00210 const Uint16 width,
00211 const int bpp,
00212 const Uint16 colors,
00213 const Uint32* palette,
00214 char *pixData ) const;
00215
00220 int readLong(Sint32& result);
00221
00226 int readDWord(Uint32& result);
00227
00232 int readWord(Uint16& result);
00233
00235 OFFile bmpFile;
00236 };
00237
00238 #endif // #ifndef I2DBMPS_H
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273