OFFIS DCMTK  Version 3.6.0
i2dbmps.h
1 /*
2  *
3  * Copyright (C) 2009-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Uli Schlachter
17  *
18  * Purpose: Class to extract pixel data and meta information from BMP file
19  *
20  * Last Update: $Author: uli $
21  * Update Date: $Date: 2010-11-15 13:58:43 $
22  * CVS/RCS Revision: $Revision: 1.9 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef I2DBMPS_H
30 #define I2DBMPS_H
31 
32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/dcmdata/libi2d/i2dimgs.h"
34 #include "dcmtk/ofstd/offile.h"
35 
39 class I2DBmpSource : public I2DImgSource
40 {
41 
42 public:
43 
47  I2DBmpSource();
48 
52  OFString inputFormat() const;
53 
77  OFCondition readPixelData( Uint16& rows,
78  Uint16& cols,
79  Uint16& samplesPerPixel,
80  OFString& photoMetrInt,
81  Uint16& bitsAlloc,
82  Uint16& bitsStored,
83  Uint16& highBit,
84  Uint16& pixelRepr,
85  Uint16& planConf,
86  Uint16& pixAspectH,
87  Uint16& pixAspectV,
88  char*& pixData,
89  Uint32& length,
90  E_TransferSyntax& ts);
91 
101  virtual OFCondition getLossyComprInfo(OFBool& srcEncodingLossy,
102  OFString& /* srcLossyComprMethod */) const
103  {
104  srcEncodingLossy = OFFalse;
105  return EC_Normal;
106  }
107 
111  virtual ~I2DBmpSource();
112 
113 protected:
114 
119  OFCondition openFile(const OFString& filename);
120 
124  void closeFile();
125 
130  OFCondition readFileHeader(Uint32 &offset);
131 
143  OFCondition readBitmapHeader(Uint16 &width /*out*/,
144  Uint16 &height /*out*/,
145  Uint16 &bpp /*out*/,
146  OFBool &isTopDown /*out*/,
147  Uint16 &colors /*out*/);
148 
154  OFCondition readColorPalette(Uint16 colors,
155  Uint32*& palette);
156 
169  OFCondition readBitmapData(const Uint16 width,
170  const Uint16 height,
171  const Uint16 bpp,
172  const OFBool isTopDown,
173  const Uint16 colors,
174  const Uint32* palette,
175  char*& pixData /*out*/,
176  Uint32& length /*out*/);
177 
185  OFCondition parse24_32BppRow(const Uint8 *row,
186  const Uint16 width,
187  const int bpp,
188  char *pixData /*out*/) const;
189 
196  OFCondition parse16BppRow(const Uint8 *row,
197  const Uint16 width,
198  char *pixData /*out*/) const;
199 
209  OFCondition parseIndexedColorRow(const Uint8 *row,
210  const Uint16 width,
211  const int bpp,
212  const Uint16 colors,
213  const Uint32* palette,
214  char *pixData /*out*/) const;
215 
220  int readLong(Sint32& result);
221 
226  int readDWord(Uint32& result);
227 
232  int readWord(Uint16& result);
233 
236 };
237 
238 #endif // #ifndef I2DBMPS_H
239 
240 /*
241  * CVS/RCS Log:
242  * $Log: i2dbmps.h,v $
243  * Revision 1.9 2010-11-15 13:58:43 uli
244  * Fixed some errors in doxygen comments.
245  *
246  * Revision 1.8 2010-10-14 13:15:46 joergr
247  * Updated copyright header. Added reference to COPYRIGHT file.
248  *
249  * Revision 1.7 2010-10-01 10:21:05 uli
250  * Fixed most compiler warnings from -Wall -Wextra -pedantic in dcmdata.
251  *
252  * Revision 1.6 2010-06-01 10:33:53 uli
253  * Added support for indexed-color BMP images (bit depths 1, 4 and 8).
254  *
255  * Revision 1.5 2010-05-25 12:40:06 uli
256  * Added support for 16bpp BMP images to libi2d
257  *
258  * Revision 1.4 2010-05-21 14:43:07 uli
259  * Added support for 32bpp BMP images to libi2d.
260  *
261  * Revision 1.3 2009-11-04 09:58:08 uli
262  * Switched to logging mechanism provided by the "new" oflog module
263  *
264  * Revision 1.2 2009-09-30 08:05:25 uli
265  * Stop including dctk.h in libi2d's header files.
266  *
267  * Revision 1.1 2009-07-16 14:25:28 onken
268  * Added img2dcm input plugin for the BMP graphics format (at the moment only
269  * support for 24 Bit RGB).
270  *
271  *
272  */
273 


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2