DJCodecDecoder Class Reference

abstract codec class for JPEG decoders. More...

Inheritance diagram for DJCodecDecoder:

DcmCodec DJDecoderBaseline DJDecoderExtended DJDecoderLossless DJDecoderP14SV1 DJDecoderProgressive DJDecoderSpectralSelection List of all members.

Public Member Functions

 DJCodecDecoder ()
 default constructor
virtual ~DJCodecDecoder ()
 destructor
virtual OFCondition decode (const DcmRepresentationParameter *fromRepParam, DcmPixelSequence *pixSeq, DcmPolymorphOBOW &uncompressedPixelData, const DcmCodecParameter *cp, const DcmStack &objStack) const
 decompresses the given pixel sequence and stores the result in the given uncompressedPixelData element.
virtual OFCondition decodeFrame (const DcmRepresentationParameter *fromParam, DcmPixelSequence *fromPixSeq, const DcmCodecParameter *cp, DcmItem *dataset, Uint32 frameNo, Uint32 &startFragment, void *buffer, Uint32 bufSize, OFString &decompressedColorModel) const
 decompresses a single frame from the given pixel sequence and stores the result in the given buffer.
virtual OFCondition encode (const Uint16 *pixelData, const Uint32 length, const DcmRepresentationParameter *toRepParam, DcmPixelSequence *&pixSeq, const DcmCodecParameter *cp, DcmStack &objStack) const
 compresses the given uncompressed DICOM image and stores the result in the given pixSeq element.
virtual OFCondition encode (const E_TransferSyntax fromRepType, const DcmRepresentationParameter *fromRepParam, DcmPixelSequence *fromPixSeq, const DcmRepresentationParameter *toRepParam, DcmPixelSequence *&toPixSeq, const DcmCodecParameter *cp, DcmStack &objStack) const
 transcodes (re-compresses) the given compressed DICOM image and stores the result in the given toPixSeq element.
virtual OFBool canChangeCoding (const E_TransferSyntax oldRepType, const E_TransferSyntax newRepType) const
 checks if this codec is able to convert from the given current transfer syntax to the given new transfer syntax
virtual OFCondition determineDecompressedColorModel (const DcmRepresentationParameter *fromParam, DcmPixelSequence *fromPixSeq, const DcmCodecParameter *cp, DcmItem *dataset, OFString &decompressedColorModel) const
 determine color model of the decompressed image
virtual E_TransferSyntax supportedTransferSyntax () const=0
 returns the transfer syntax that this particular codec is able to decode.

Private Member Functions

virtual DJDecodercreateDecoderInstance (const DcmRepresentationParameter *toRepParam, const DJCodecParameter *cp, Uint8 bitsPerSample, OFBool isYBR) const=0
 creates an instance of the compression library to be used for decoding.

Static Private Member Functions

static Uint8 scanJpegDataForBitDepth (const Uint8 *data, const Uint32 fragmentLength)
 scans the given block of JPEG data for a Start of Frame marker and returns the number of bits per pixel stored in the Start of Frame block.
static Uint16 readUint16 (const Uint8 *data)
 reads two bytes from the given array of little endian 16-bit values and returns the value as Uint16 in local byte order.
static OFCondition createPlanarConfigurationByte (Uint8 *imageFrame, Uint16 columns, Uint16 rows)
 converts an RGB or YBR frame with 8 bits/sample from color-by-pixel to color-by-plane planar configuration.
static OFCondition createPlanarConfigurationWord (Uint16 *imageFrame, Uint16 columns, Uint16 rows)
 converts an RGB or YBR frame with 16 bits/sample from color-by-pixel to color-by-plane planar configuration.
static OFBool requiresPlanarConfiguration (const char *sopClassUID, EP_Interpretation photometricInterpretation)
 examines if a given image requires color-by-plane planar configuration depending on SOP Class UID (DICOM IOD) and photometric interpretation.

Detailed Description

abstract codec class for JPEG decoders.

This abstract class contains most of the application logic needed for a dcmdata codec object that implements a JPEG decoder using the DJDecoder interface to the underlying JPEG implementation. This class only supports decompression, it neither implements encoding nor transcoding.

Definition at line 53 of file djcodecd.h.


Member Function Documentation

virtual OFCondition DJCodecDecoder::decode ( const DcmRepresentationParameter fromRepParam,
DcmPixelSequence pixSeq,
DcmPolymorphOBOW uncompressedPixelData,
const DcmCodecParameter cp,
const DcmStack objStack 
) const [virtual]

decompresses the given pixel sequence and stores the result in the given uncompressedPixelData element.

Parameters:
fromRepParam current representation parameter of compressed data, may be NULL
pixSeq compressed pixel sequence
uncompressedPixelData uncompressed pixel data stored in this element
cp codec parameters for this codec
objStack stack pointing to the location of the pixel data element in the current dataset.
Returns:
EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

virtual OFCondition DJCodecDecoder::decodeFrame ( const DcmRepresentationParameter fromParam,
DcmPixelSequence fromPixSeq,
const DcmCodecParameter cp,
DcmItem dataset,
Uint32  frameNo,
Uint32 &  startFragment,
void *  buffer,
Uint32  bufSize,
OFString decompressedColorModel 
) const [virtual]

decompresses a single frame from the given pixel sequence and stores the result in the given buffer.

Parameters:
fromParam representation parameter of current compressed representation, may be NULL.
fromPixSeq compressed pixel sequence
cp codec parameters for this codec
dataset pointer to dataset in which pixel data element is contained
frameNo number of frame, starting with 0 for the first frame
startFragment index of the compressed fragment that contains all or the first part of the compressed bitstream for the given frameNo. Upon successful return this parameter is updated to contain the index of the first compressed fragment of the next frame. When unknown, zero should be passed. In this case the decompression algorithm will try to determine the index by itself, which will always work if frames are decompressed in increasing order from first to last, but may fail if frames are decompressed in random order, multiple fragments per frame and multiple frames are present in the dataset, and the offset table is empty.
buffer pointer to buffer where frame is to be stored
bufSize size of buffer in bytes
decompressedColorModel upon successful return, the color model of the decompressed image (which may be different from the one used in the compressed images) is returned in this parameter.
Returns:
EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

virtual OFCondition DJCodecDecoder::encode ( const Uint16 *  pixelData,
const Uint32  length,
const DcmRepresentationParameter toRepParam,
DcmPixelSequence *&  pixSeq,
const DcmCodecParameter cp,
DcmStack objStack 
) const [virtual]

compresses the given uncompressed DICOM image and stores the result in the given pixSeq element.

Parameters:
pixelData pointer to the uncompressed image data in OW format and local byte order
length of the pixel data field in bytes
toRepParam representation parameter describing the desired compressed representation (e.g. JPEG quality)
pixSeq compressed pixel sequence (pointer to new DcmPixelSequence object allocated on heap) returned in this parameter upon success.
cp codec parameters for this codec
objStack stack pointing to the location of the pixel data element in the current dataset.
Returns:
EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

virtual OFCondition DJCodecDecoder::encode ( const E_TransferSyntax  fromRepType,
const DcmRepresentationParameter fromRepParam,
DcmPixelSequence fromPixSeq,
const DcmRepresentationParameter toRepParam,
DcmPixelSequence *&  toPixSeq,
const DcmCodecParameter cp,
DcmStack objStack 
) const [virtual]

transcodes (re-compresses) the given compressed DICOM image and stores the result in the given toPixSeq element.

Parameters:
fromRepType current transfer syntax of the compressed image
fromRepParam current representation parameter of compressed data, may be NULL
fromPixSeq compressed pixel sequence
toRepParam representation parameter describing the desired new compressed representation (e.g. JPEG quality)
toPixSeq compressed pixel sequence (pointer to new DcmPixelSequence object allocated on heap) returned in this parameter upon success.
cp codec parameters for this codec
objStack stack pointing to the location of the pixel data element in the current dataset.
Returns:
EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

virtual OFBool DJCodecDecoder::canChangeCoding ( const E_TransferSyntax  oldRepType,
const E_TransferSyntax  newRepType 
) const [virtual]

checks if this codec is able to convert from the given current transfer syntax to the given new transfer syntax

Parameters:
oldRepType current transfer syntax
newRepType desired new transfer syntax
Returns:
true if transformation is supported by this codec, false otherwise.

Implements DcmCodec.

virtual OFCondition DJCodecDecoder::determineDecompressedColorModel ( const DcmRepresentationParameter fromParam,
DcmPixelSequence fromPixSeq,
const DcmCodecParameter cp,
DcmItem dataset,
OFString decompressedColorModel 
) const [virtual]

determine color model of the decompressed image

Parameters:
fromParam representation parameter of current compressed representation, may be NULL
fromPixSeq compressed pixel sequence
cp codec parameters for this codec
dataset pointer to dataset in which pixel data element is contained
dataset pointer to DICOM dataset in which this pixel data object is located. Used to access photometric interpretation.
decompressedColorModel upon successful return, the color model of the decompressed image (which may be different from the one used in the compressed images) is returned in this parameter
Returns:
EC_Normal if successful, an error code otherwise

Implements DcmCodec.

virtual E_TransferSyntax DJCodecDecoder::supportedTransferSyntax (  )  const [pure virtual]

returns the transfer syntax that this particular codec is able to decode.

Returns:
supported transfer syntax

Implemented in DJDecoderBaseline, DJDecoderExtended, DJDecoderLossless, DJDecoderProgressive, DJDecoderSpectralSelection, and DJDecoderP14SV1.

virtual DJDecoder* DJCodecDecoder::createDecoderInstance ( const DcmRepresentationParameter toRepParam,
const DJCodecParameter cp,
Uint8  bitsPerSample,
OFBool  isYBR 
) const [private, pure virtual]

creates an instance of the compression library to be used for decoding.

Parameters:
toRepParam representation parameter passed to decode()
cp codec parameter passed to decode()
bitsPerSample bits per sample for the image data
isYBR flag indicating whether DICOM photometric interpretation is YCbCr
Returns:
pointer to newly allocated decoder object

Implemented in DJDecoderBaseline, DJDecoderExtended, DJDecoderLossless, DJDecoderProgressive, DJDecoderSpectralSelection, and DJDecoderP14SV1.

static Uint8 DJCodecDecoder::scanJpegDataForBitDepth ( const Uint8 *  data,
const Uint32  fragmentLength 
) [static, private]

scans the given block of JPEG data for a Start of Frame marker and returns the number of bits per pixel stored in the Start of Frame block.

Parameters:
data pointer to array, must not be NULL
fragmentLength size of array
Returns:
bit depth of JPEG data, 0 if no SOF marker found or parse error

static Uint16 DJCodecDecoder::readUint16 ( const Uint8 *  data  )  [static, private]

reads two bytes from the given array of little endian 16-bit values and returns the value as Uint16 in local byte order.

Parameters:
data pointer to array, must not be NULL, must at least 2 bytes large
Returns:
Uint16 read from array

static OFCondition DJCodecDecoder::createPlanarConfigurationByte ( Uint8 *  imageFrame,
Uint16  columns,
Uint16  rows 
) [static, private]

converts an RGB or YBR frame with 8 bits/sample from color-by-pixel to color-by-plane planar configuration.

Parameters:
imageFrame pointer to image frame, must contain at least 3*columns*rows bytes of pixel data.
columns columns
rows rows
Returns:
EC_Normal if successful, an error code otherwise

static OFCondition DJCodecDecoder::createPlanarConfigurationWord ( Uint16 *  imageFrame,
Uint16  columns,
Uint16  rows 
) [static, private]

converts an RGB or YBR frame with 16 bits/sample from color-by-pixel to color-by-plane planar configuration.

Parameters:
imageFrame pointer to image frame, must contain at least 3*columns*rows words of pixel data.
columns columns
rows rows
Returns:
EC_Normal if successful, an error code otherwise

static OFBool DJCodecDecoder::requiresPlanarConfiguration ( const char *  sopClassUID,
EP_Interpretation  photometricInterpretation 
) [static, private]

examines if a given image requires color-by-plane planar configuration depending on SOP Class UID (DICOM IOD) and photometric interpretation.

All SOP classes defined in the 2003 edition of the DICOM standard or earlier are handled correctly.

Parameters:
sopClassUID SOP Class UID
photometricInterpretation decompressed photometric interpretation
Returns:
true if color-by-plane is required, false otherwise.


The documentation for this class was generated from the following file:


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1