Inheritance diagram for I2DJpegSource:
Public Member Functions | |
I2DJpegSource () | |
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 JPEG pixel data stream from a JPEG file and returns some image information about this pixel data. | |
OFCondition | getLossyComprInfo (OFBool &srcEncodingLossy, OFString &srcLossyComprMethod) const |
void | setExtSeqSupport (const OFBool enabled) |
Enable/Disable support for Extended Sequential JPEG Coding. | |
void | setProgrSupport (const OFBool enabled) |
Enable/Disable support for Progressive JPEG Coding. | |
void | setInsistOnJFIF (const OFBool enabled) |
If enabled, conversion will only take place if JFIF data could be found and evaluated. | |
void | setKeepAPPn (const OFBool enabled) |
If enabled, APPn markers (except JFIF!) are also copied to the output file. | |
~I2DJpegSource () | |
Destructor, frees some memory. | |
Static Public Member Functions | |
static OFString | jpegMarkerToString (const E_JPGMARKER &marker) |
Returns a string representation of a JPEG marker code. | |
Protected Member Functions | |
OFCondition | openFile (const OFString &filename) |
Opens the JPEG file specified by the given filename. | |
void | closeFile () |
Closes JPEG file. | |
OFCondition | createJPEGFileMap () |
Function that scans a JPEG file and creates a "file map" which includes all JPEG markes and their byte positions in the file. | |
void | debugDumpJPEGFileMap () const |
Dump the internal JPEG file map to a given stream. | |
OFCondition | getSOFImageParameters (const JPEGFileMapEntry &entry, Uint16 &imageWidth, Uint16 &imageHeight, Uint16 &samplesPerPixel, Uint16 &bitsPerSample) |
Get image parameters as found at given SOF marker of the JPEG image. | |
OFCondition | getJFIFImageParameters (const JPEGFileMapEntry &entry, Uint16 &jfifVersion, Uint16 &pixelAspectH, Uint16 &pixelAspectV, Uint16 &unit) |
Get JPEG parameters as found at given JFIF marker of the JPEG image. | |
OFCondition | isJPEGEncodingSupported (const E_JPGMARKER &jpegEncoding) const |
Check, whether a given JPEG image marker (SOFn) is supported by this plugin. | |
OFCondition | extractRawJPEGStream (char *&pixelData, Uint32 &pixLength) |
Extract raw JPEG stream (i.e. | |
OFCondition | copyJPEGStream (char *&pixelData, Uint32 &pixLength) |
Copies JPEG stream (with APPn markers, excluding JFIF) from JPEG file. | |
OFCondition | skipVariable () |
Skips one marker while scanning through the JPEG file stream. | |
OFCondition | firstMarker (E_JPGMARKER &result) |
Tries to read the SOI marker. | |
OFCondition | nextMarker (const OFBool &lastWasSOSMarker, E_JPGMARKER &result) |
Tries to find the next JPEG marker in underlying file stream. | |
int | read2Bytes (Uint16 &result) |
Read 2 bytes from the byte stream. | |
int | read1Byte (Uint8 &result) |
Read 1 byte from the byte stream. | |
void | clearMap () |
Deletes internal JPEG file map and frees memory. | |
Static Protected Member Functions | |
static E_TransferSyntax | associatedTS (const E_JPGMARKER &jpegEncoding) |
Returns if possible the DICOM transfer syntax matching the coding of the JPEG data. | |
static OFBool | isRSTMarker (const E_JPGMARKER &jpegEncoding) |
Returns true if marker is one of the RST0 to RST7 markers. | |
static OFBool | isSOFMarker (const E_JPGMARKER &jpegEncoding) |
Returns true if marker is one of the SOF0 to SOF15 markers. | |
Protected Attributes | |
OFList< JPEGFileMapEntry * > | m_jpegFileMap |
JPEG file map. This map includes all JPEG markers and their byte positions in the JPEG file. | |
OFFile | jpegFile |
The JPEG file, if opened. | |
OFBool | m_disableProgrTs |
If true, JPEGs with progressive coding are not supported. | |
OFBool | m_disableExtSeqTs |
If true, JPEGs with extended sequential coding are not supported. | |
OFBool | m_insistOnJFIF |
If true, conversion will only work if JFIF header can be found. | |
OFBool | m_keepAPPn |
If true, APPn markers (except JFIF!) are also copied to the output file. | |
OFBool | m_lossyCompressed |
After reading pixel data, this denotes whether the source data is already lossy compressed. |
Definition at line 80 of file i2djpgs.h.
I2DJpegSource::I2DJpegSource | ( | ) |
Constructor, initializes member variables.
I2DJpegSource::~I2DJpegSource | ( | ) |
Destructor, frees some memory.
OFString I2DJpegSource::inputFormat | ( | ) | const [virtual] |
Returns format of input image.
For this class "JPEG" is returned.
Implements I2DImgSource.
OFCondition I2DJpegSource::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 JPEG pixel data stream from a JPEG file and returns some image information about this pixel data.
Raw means here that all APP markers (e.g. JFIF information) are removed from the JPEG stream. The pixel data returned is a JPEG stream in JPEG interchange format. This function allocates memory for the pixel data returned to the user. The caller of this function is responsible for deleting the memory buffer
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 JPEG Interchange Format (but without APPx markers). | |
length | - [out] Length of pixel data | |
ts | - [out] The transfer syntax imposed by the imported pixel pixel data. This is necessary for the JPEG importer that needs to report which TS must be used for the imported JPEG data (ie. baseline, progressive, ...). |
Implements I2DImgSource.
void I2DJpegSource::setExtSeqSupport | ( | const OFBool | enabled | ) |
Enable/Disable support for Extended Sequential JPEG Coding.
enabled | - [in] OFTrue: support Extended Sequential, OFTrue: Do not support |
void I2DJpegSource::setProgrSupport | ( | const OFBool | enabled | ) |
Enable/Disable support for Progressive JPEG Coding.
enabled | - [in] OFTrue: support Extended Sequential, OFTrue: Do not support |
void I2DJpegSource::setInsistOnJFIF | ( | const OFBool | enabled | ) |
If enabled, conversion will only take place if JFIF data could be found and evaluated.
Many digital cameras do not provide a JFIF header, so this is disabled by default.
void I2DJpegSource::setKeepAPPn | ( | const OFBool | enabled | ) |
If enabled, APPn markers (except JFIF!) are also copied to the output file.
This can cause a huge speedup because instead of parsing the whole JPEG file (for finding any APPn markers) the parsing stops after finding the SOFn marker (which is relevant for extracting width/height and so on. Default: false
enabled | - [in] OFtrue: copy APPn, OFFalse: cut off APPn info |
static OFString I2DJpegSource::jpegMarkerToString | ( | const E_JPGMARKER & | marker | ) | [static] |
Returns a string representation of a JPEG marker code.
marker | - [in] The marker to be converted |
OFCondition I2DJpegSource::openFile | ( | const OFString & | filename | ) | [protected] |
Opens the JPEG file specified by the given filename.
filename | - [in] The file to be opened |
void I2DJpegSource::closeFile | ( | ) | [protected] |
Closes JPEG file.
OFCondition I2DJpegSource::createJPEGFileMap | ( | ) | [protected] |
Function that scans a JPEG file and creates a "file map" which includes all JPEG markes and their byte positions in the file.
void I2DJpegSource::debugDumpJPEGFileMap | ( | ) | const [protected] |
Dump the internal JPEG file map to a given stream.
The file map lists JPEG markers and their position in the bitstream found in the JPEG file
OFCondition I2DJpegSource::getSOFImageParameters | ( | const JPEGFileMapEntry & | entry, | |
Uint16 & | imageWidth, | |||
Uint16 & | imageHeight, | |||
Uint16 & | samplesPerPixel, | |||
Uint16 & | bitsPerSample | |||
) | [protected] |
Get image parameters as found at given SOF marker of the JPEG image.
entry | - [in] This specifies the marker and the byte position of the SOF marker | |
imageWidth | - [out] The width of the image | |
imageHeight | - [out] The height of the image | |
samplesPerPixel | - [out] Number of components per pixel | |
bitsPerSample | - [out] Nunber of bits per pixel component |
OFCondition I2DJpegSource::getJFIFImageParameters | ( | const JPEGFileMapEntry & | entry, | |
Uint16 & | jfifVersion, | |||
Uint16 & | pixelAspectH, | |||
Uint16 & | pixelAspectV, | |||
Uint16 & | unit | |||
) | [protected] |
Get JPEG parameters as found at given JFIF marker of the JPEG image.
entry | - [in] This specifies the marker and the byte position of the JFIF marker | |
jfifVersion | - [out] The JFIF version of the JFIF data | |
pixelAspectH | - [out] The horizontal pixel aspect ratio | |
pixelAspectV | - [out] The vertical pixel aspect ratio | |
unit | - [out] The contents of the pixel aspect ratio unit field |
OFCondition I2DJpegSource::isJPEGEncodingSupported | ( | const E_JPGMARKER & | jpegEncoding | ) | const [protected] |
Check, whether a given JPEG image marker (SOFn) is supported by this plugin.
jpegEncoding | - [in] Image marker that should be tested |
static E_TransferSyntax I2DJpegSource::associatedTS | ( | const E_JPGMARKER & | jpegEncoding | ) | [static, protected] |
Returns if possible the DICOM transfer syntax matching the coding of the JPEG data.
jpegEncoding | - [in] Image marker that should be tested |
static OFBool I2DJpegSource::isRSTMarker | ( | const E_JPGMARKER & | jpegEncoding | ) | [static, protected] |
Returns true if marker is one of the RST0 to RST7 markers.
jpegEncoding | - [in] Image marker that should be tested |
static OFBool I2DJpegSource::isSOFMarker | ( | const E_JPGMARKER & | jpegEncoding | ) | [static, protected] |
Returns true if marker is one of the SOF0 to SOF15 markers.
jpegEncoding | - [in] Image marker that should be tested |
OFCondition I2DJpegSource::extractRawJPEGStream | ( | char *& | pixelData, | |
Uint32 & | pixLength | |||
) | [protected] |
Extract raw JPEG stream (i.e.
without APPn markers) from JPEG file.
pixelData | - [out] The resulting JPEG stream | |
pixLength | - [out] The length of the resulting stream |
OFCondition I2DJpegSource::copyJPEGStream | ( | char *& | pixelData, | |
Uint32 & | pixLength | |||
) | [protected] |
Copies JPEG stream (with APPn markers, excluding JFIF) from JPEG file.
pixelData | - [out] The resulting JPEG stream | |
pixLength | - [out] The length of the resulting stream |
OFCondition I2DJpegSource::skipVariable | ( | ) | [protected] |
Skips one marker while scanning through the JPEG file stream.
OFCondition I2DJpegSource::firstMarker | ( | E_JPGMARKER & | result | ) | [protected] |
Tries to read the SOI marker.
result | - [out] The code of the SOI marker if successful (0xD8) |
OFCondition I2DJpegSource::nextMarker | ( | const OFBool & | lastWasSOSMarker, | |
E_JPGMARKER & | result | |||
) | [protected] |
Tries to find the next JPEG marker in underlying file stream.
lastWasSOSMarker | - [in] Denotes, whether the last marker read before was the SOS (start of scan) marker. This is needed to ignore non-marker 0xFF ocurrences in the compressed data. | |
result | - [out] The result marker |
int I2DJpegSource::read2Bytes | ( | Uint16 & | result | ) | [inline, protected] |
Read 2 bytes from the byte stream.
result | - [out] The result |
int I2DJpegSource::read1Byte | ( | Uint8 & | result | ) | [inline, protected] |
Read 1 byte from the byte stream.
result | - [out] The result |
void I2DJpegSource::clearMap | ( | ) | [protected] |
Deletes internal JPEG file map and frees memory.
OFBool I2DJpegSource::m_insistOnJFIF [protected] |
OFBool I2DJpegSource::m_keepAPPn [protected] |
If true, APPn markers (except JFIF!) are also copied to the output file.
This can cause a huge speedup because instead of parsing the whole JPEG file (for finding any APPn markers) the parsing stops after finding the SOFn marker (which is relevant for extracting width/height and so on. Default: false