Loading...
Searching...
No Matches
I2DBmpSource Class Reference

This is a I2DImgSource implementation that can parse BMP files and convert them into DICOM images. More...

Inheritance diagram for I2DBmpSource:

## Public Member Functions

| I2DBmpSource ()
| Constructor, initializes member variables.
OFString | inputFormat () const
| Returns format of input image.
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.
virtual OFCondition | getLossyComprInfo (OFBool &srcEncodingLossy, OFString &srcLossyComprMethod) const
| After reading of pixel data, this function can be used for getting information about lossy compression parameters.
virtual | ~I2DBmpSource ()
| Destructor, frees some memory.
Public Member Functions inherited from I2DImgSource
| I2DImgSource ()
| Constructor.
void | setImageFile (const OFString &filename)
| Sets the input image file to read.
OFString | getImageFile ()
| Returns the input image file that currently associated with plugin.
virtual | ~I2DImgSource ()
| Virtual Destructor.

## Protected Member Functions

OFCondition | openFile (const OFString &filename)
| Opens the BMP file specified by the given filename.
void | closeFile ()
| Closes BMP file.
OFCondition | readFileHeader (Uint32 &offset)
| Reads and checks the BMP file header.
OFCondition | readBitmapHeader (Uint16 &width, Uint16 &height, Uint16 &bpp, OFBool &isTopDown, Uint16 &colors)
| Reads and checks the BMP bitmap header.
OFCondition | readColorPalette (Uint16 colors, OFBool &isMonochrome, Uint32 *&palette)
| Read the color palette from the file.
OFCondition | readBitmapData (const Uint16 width, const Uint16 height, const Uint16 bpp, const OFBool isTopDown, const OFBool isMonochrome, const Uint16 colors, const Uint32 *palette, char *&pixData, Uint32 &length)
| Read the bitmap data.
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.
OFCondition | parse16BppRow (const Uint8 *row, const Uint16 width, char *pixData) const
| Parse a single 16bpp row of BMP data.
OFCondition | parseIndexedColorRow (const Uint8 *row, const Uint16 width, const int bpp, const Uint16 colors, const Uint32 *palette, const OFBool isMonochrome, char *pixData) const
| Parse a single 1, 4 or 8bpp row of BMP data.
int | readLong (Sint32 &result)
| Read 4 bytes from the byte stream and interpret it as a signed integer.
int | readDWord (Uint32 &result)
| Read 4 bytes from the byte stream.
int | readWord (Uint16 &result)
| Read 2 bytes from the byte stream.

## Protected Attributes

OFFile | bmpFile
| The BMP file, if opened.
Protected Attributes inherited from I2DImgSource
OFString | m_imageFile
| The input file.

## Detailed Description

This is a I2DImgSource implementation that can parse BMP files and convert them into DICOM images.

## Member Function Documentation

## getLossyComprInfo()

virtual OFCondition I2DBmpSource::getLossyComprInfo | ( | OFBool & | srcEncodingLossy,
|  | OFString & | srcLossyComprMethod ) const

inline virtual

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.

## inputFormat()

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.

## openFile()

OFCondition I2DBmpSource::openFile | ( | const OFString & | filename | ) |

protected

Opens the BMP file specified by the given filename.

Parameters

  filename | - [in] The file to be opened

Returns
  EC_Normal, if successful, error otherwise

## parse16BppRow()

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

## parse24_32BppRow()

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

## parseIndexedColorRow()

OFCondition I2DBmpSource::parseIndexedColorRow | ( | const Uint8 * | row,
|  | const Uint16 | width,
|  | const int | bpp,
|  | const Uint16 | colors,
|  | const Uint32 * | palette,
|  | const OFBool | isMonochrome,
|  | 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.
  isMonochrome | - [in] If true, this is a monochrome palette color image
  pixData | - [out] The buffer to write the data to (in "RGB" format).

Returns
  EC_Normal, if successful, error otherwise

## readBitmapData()

OFCondition I2DBmpSource::readBitmapData | ( | const Uint16 | width,
|  | const Uint16 | height,
|  | const Uint16 | bpp,
|  | const OFBool | isTopDown,
|  | const OFBool | isMonochrome,
|  | 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
  isMonochrome | - [in] If true, this is a monochrome palette color image
  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

## readBitmapHeader()

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

## readColorPalette()

OFCondition I2DBmpSource::readColorPalette | ( | Uint16 | colors,
|  | OFBool & | isMonochrome,
|  | Uint32 *& | palette )

protected

Read the color palette from the file.

Parameters

  colors | - [in] number of colors to read
  isMonochrome | - [out] true if the palette is monochrome
  palette | - [out] the read color palette is stored here

Returns
  EC_Normal, if successful, error otherwise

## readDWord()

int I2DBmpSource::readDWord | ( | Uint32 & | result | ) |

protected

Read 4 bytes from the byte stream.

Parameters

  result | - [out] The result

Returns
  0, if successful, EOF if rest of stream does not contain enough bytes

## readFileHeader()

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

## readLong()

int I2DBmpSource::readLong | ( | Sint32 & | result | ) |

protected

Read 4 bytes from the byte stream and interpret it as a signed integer.

Parameters

  result | - [out] The result

Returns
  0, if successful, EOF if rest of stream does not contain enough bytes

## readPixelData()

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.

## readWord()

int I2DBmpSource::readWord | ( | Uint16 & | result | ) |

protected

Read 2 bytes from the byte stream.

Parameters

  result | - [out] The result

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

Generated on for DCMTK Version 3.7.0 by Doxygen 1.15.0