This is a I2DImgSource implementation that can parse BMP files and convert them into DICOM images.
More...
|
| I2DBmpSource () |
| Constructor, initializes member variables. More...
|
|
OFString | inputFormat () const |
| Returns format of input image. More...
|
|
OFCondition | readPixelData (Uint16 &rows, Uint16 &cols, Uint16 &samplesPerPixel, OFString &photoMetrInt, Uint16 &bitsAlloc, Uint16 &bitsStored, Uint16 &highBit, Uint16 &pixelRepr, Uint16 &planConf, Uint16 &pixAspectH, Uint16 &pixAspectV, char *&pixData, Uint32 &length, E_TransferSyntax &ts) |
| Extracts the raw BMP pixel data stream from a BMP file and returns some further information about this pixel data. More...
|
|
virtual OFCondition | getLossyComprInfo (OFBool &srcEncodingLossy, OFString &) const |
| After reading of pixel data, this function can be used for getting information about lossy compression parameters. More...
|
|
virtual | ~I2DBmpSource () |
| Destructor, frees some memory. More...
|
|
| I2DImgSource () |
| Constructor.
|
|
void | setImageFile (const OFString &filename) |
| Sets the input image file to read. More...
|
|
OFString | getImageFile () |
| Returns the input image file that currently associated with plugin. More...
|
|
virtual | ~I2DImgSource () |
| Virtual Destructor.
|
|
|
OFCondition | openFile (const OFString &filename) |
| Opens the BMP file specified by the given filename. More...
|
|
void | closeFile () |
| Closes BMP file. More...
|
|
OFCondition | readFileHeader (Uint32 &offset) |
| Reads and checks the BMP file header. More...
|
|
OFCondition | readBitmapHeader (Uint16 &width, Uint16 &height, Uint16 &bpp, OFBool &isTopDown, Uint16 &colors) |
| Reads and checks the BMP bitmap header. More...
|
|
OFCondition | readColorPalette (Uint16 colors, Uint32 *&palette) |
| Read the color palette from the file. More...
|
|
OFCondition | readBitmapData (const Uint16 width, const Uint16 height, const Uint16 bpp, const OFBool isTopDown, const Uint16 colors, const Uint32 *palette, char *&pixData, Uint32 &length) |
| Read the bitmap data. More...
|
|
OFCondition | parse24_32BppRow (const Uint8 *row, const Uint16 width, const int bpp, char *pixData) const |
| Parse a single 24bpp or 32bpp row of BMP data. More...
|
|
OFCondition | parse16BppRow (const Uint8 *row, const Uint16 width, char *pixData) const |
| Parse a single 16bpp row of BMP data. More...
|
|
OFCondition | parseIndexedColorRow (const Uint8 *row, const Uint16 width, const int bpp, const Uint16 colors, const Uint32 *palette, char *pixData) const |
| Parse a single 1, 4 or 8bpp row of BMP data. More...
|
|
int | readLong (Sint32 &result) |
| Read 4 bytes from the byte stream and interpret it as a signed integer. More...
|
|
int | readDWord (Uint32 &result) |
| Read 4 bytes from the byte stream. More...
|
|
int | readWord (Uint16 &result) |
| Read 2 bytes from the byte stream. More...
|
|
This is a I2DImgSource implementation that can parse BMP files and convert them into DICOM images.
I2DBmpSource::I2DBmpSource |
( |
| ) |
|
Constructor, initializes member variables.
- Returns
- none
virtual I2DBmpSource::~I2DBmpSource |
( |
| ) |
|
|
virtual |
Destructor, frees some memory.
- Returns
- none
void I2DBmpSource::closeFile |
( |
| ) |
|
|
protected |
Closes BMP file.
- Returns
- none
After reading of pixel data, this function can be used for getting information about lossy compression parameters.
- Parameters
-
srcEncodingLossy | - [out] Always returns OFFalse (i.e. lossless) |
srcLossyComprMethod | - [out] Unused parameter |
- Returns
- EC_Normal if information is available, error otherwise
Implements I2DImgSource.
References EC_Normal.
OFString I2DBmpSource::inputFormat |
( |
| ) |
const |
|
virtual |
Returns format of input image.
For this class "BMP" is returned.
- Returns
- Returns format of input image, i.e. "BMP".
Implements I2DImgSource.
Opens the BMP file specified by the given filename.
- Parameters
-
filename | - [in] The file to be opened |
- Returns
- EC_Normal, if successful, error otherwise
OFCondition I2DBmpSource::parse16BppRow |
( |
const Uint8 * |
row, |
|
|
const Uint16 |
width, |
|
|
char * |
pixData |
|
) |
| const |
|
protected |
Parse a single 16bpp row of BMP data.
- Parameters
-
row | - [in] The row of data to parse. |
width | - [in] The length in pixel of the row. |
pixData | - [out] The buffer to write the data to (in "RGB" format). |
- Returns
- EC_Normal, if successful, error otherwise
OFCondition I2DBmpSource::parse24_32BppRow |
( |
const Uint8 * |
row, |
|
|
const Uint16 |
width, |
|
|
const int |
bpp, |
|
|
char * |
pixData |
|
) |
| const |
|
protected |
Parse a single 24bpp or 32bpp row of BMP data.
- Parameters
-
row | - [in] The row of data to parse. |
width | - [in] The length in pixel of the row. |
bpp | - [in] The number of bits per pixel. |
pixData | - [out] The buffer to write the data to (in "RGB" format). |
- Returns
- EC_Normal, if successful, error otherwise
OFCondition I2DBmpSource::parseIndexedColorRow |
( |
const Uint8 * |
row, |
|
|
const Uint16 |
width, |
|
|
const int |
bpp, |
|
|
const Uint16 |
colors, |
|
|
const Uint32 * |
palette, |
|
|
char * |
pixData |
|
) |
| const |
|
protected |
Parse a single 1, 4 or 8bpp row of BMP data.
- Parameters
-
row | - [in] The row of data to parse. |
width | - [in] The length in pixel of the row. |
bpp | - [in] The number of bits per pixel. |
colors | - [in] The number of entries in the color palette. |
palette | - [in] The color palette to use. |
pixData | - [out] The buffer to write the data to (in "RGB" format). |
- Returns
- EC_Normal, if successful, error otherwise
OFCondition I2DBmpSource::readBitmapData |
( |
const Uint16 |
width, |
|
|
const Uint16 |
height, |
|
|
const Uint16 |
bpp, |
|
|
const OFBool |
isTopDown, |
|
|
const Uint16 |
colors, |
|
|
const Uint32 * |
palette, |
|
|
char *& |
pixData, |
|
|
Uint32 & |
length |
|
) |
| |
|
protected |
Read the bitmap data.
This assumes the current read position is at the start of the image data.
- Parameters
-
width | - [in] width of the image in pixel |
height | - [in] height of the image in pixel |
bpp | - [in] Image's bits per pixel. |
isTopDown | - [in] If true, this is a top down bitmap |
colors | - [in] Number of color palette entries |
palette | - [in] Color palette |
pixData | - [out] Image data |
length | - [out] Length of data |
- Returns
- EC_Normal, if successful, error otherwise
OFCondition I2DBmpSource::readBitmapHeader |
( |
Uint16 & |
width, |
|
|
Uint16 & |
height, |
|
|
Uint16 & |
bpp, |
|
|
OFBool & |
isTopDown, |
|
|
Uint16 & |
colors |
|
) |
| |
|
protected |
Reads and checks the BMP bitmap header.
After this function, the current read position is just after the header. That is, at the beginning of the color palette.
- Parameters
-
width | - [out] width of the image in pixel |
height | - [out] height of the image in pixel |
isTopDown | - [out] OFTrue if this is a top down bitmap (height was read as negative value). OFFalse otherwise. |
bpp | - [out] bits per pixel of the image. |
colors | - [out] number of entries in color table. |
- Returns
- EC_Normal, if successful, error otherwise
OFCondition I2DBmpSource::readColorPalette |
( |
Uint16 |
colors, |
|
|
Uint32 *& |
palette |
|
) |
| |
|
protected |
Read the color palette from the file.
- Parameters
-
colors | - [in] number of colors to read |
palette | - [out] the read color palette is stored here |
- Returns
- EC_Normal, if successful, error otherwise
int I2DBmpSource::readDWord |
( |
Uint32 & |
result | ) |
|
|
protected |
Read 4 bytes from the byte stream.
- Parameters
-
- Returns
- 0, if successful, EOF if rest of stream does not contain enough bytes
OFCondition I2DBmpSource::readFileHeader |
( |
Uint32 & |
offset | ) |
|
|
protected |
Reads and checks the BMP file header.
- Parameters
-
offset | - [out] Offset to the BMP data from beginning of file |
- Returns
- EC_Normal, if successful, error otherwise
int I2DBmpSource::readLong |
( |
Sint32 & |
result | ) |
|
|
protected |
Read 4 bytes from the byte stream and interpret it as a signed integer.
- Parameters
-
- Returns
- 0, if successful, EOF if rest of stream does not contain enough bytes
OFCondition I2DBmpSource::readPixelData |
( |
Uint16 & |
rows, |
|
|
Uint16 & |
cols, |
|
|
Uint16 & |
samplesPerPixel, |
|
|
OFString & |
photoMetrInt, |
|
|
Uint16 & |
bitsAlloc, |
|
|
Uint16 & |
bitsStored, |
|
|
Uint16 & |
highBit, |
|
|
Uint16 & |
pixelRepr, |
|
|
Uint16 & |
planConf, |
|
|
Uint16 & |
pixAspectH, |
|
|
Uint16 & |
pixAspectV, |
|
|
char *& |
pixData, |
|
|
Uint32 & |
length, |
|
|
E_TransferSyntax & |
ts |
|
) |
| |
|
virtual |
Extracts the raw BMP pixel data stream from a BMP file and returns some further information about this pixel data.
Raw means that any header information is removed from the BMP stream. This function allocates memory for the pixel data returned to the user. The caller of this function is responsible for deleting the memory buffer.
- Parameters
-
rows | - [out] Rows of image |
cols | - [out] Columns of image |
samplesPerPixel | - [out] Number of components per pixel |
photoMetrInt | - [out] The DICOM color model used for the compressed data |
bitsAlloc | - [out] Bits Allocated for one sample |
bitsStored | - [out] Bits Stored, Number of bits actually stored within Bits Allocated |
highBit | - [out] High Bit, Highest stored in bit within Bits Allocated |
pixelRepr | - [out] Pixel Representation (0=unsigned, 1=signed) |
planConf | - [out] Planar Configuration |
pixAspectH | - [out] Horizontal value of pixel aspect ratio |
pixAspectV | - [out] Vertical value of pixel aspect ratio |
pixData | - [out] Pointer to the pixel data in BMP Interchange Format |
length | - [out] Length of pixel data |
ts | - [out] The transfer syntax imposed by the imported pixel pixel data |
- Returns
- EC_Normal, if successful, error otherwise
Implements I2DImgSource.
int I2DBmpSource::readWord |
( |
Uint16 & |
result | ) |
|
|
protected |
Read 2 bytes from the byte stream.
- Parameters
-
- Returns
- 0, if successful, EOF if rest of stream does not contain enough bytes
The documentation for this class was generated from the following file:
- dcmdata/include/dcmtk/dcmdata/libi2d/i2dbmps.h