DCMTK  Version 3.6.4
OFFIS DICOM Toolkit
Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
DJCodecDecoder Class Referenceabstract

abstract codec class for JPEG decoders. More...

+ Inheritance diagram for DJCodecDecoder:

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 More...
 
virtual OFCondition determineDecompressedColorModel (const DcmRepresentationParameter *fromParam, DcmPixelSequence *fromPixSeq, const DcmCodecParameter *cp, DcmItem *dataset, OFString &decompressedColorModel) const
 determine color model of the decompressed image More...
 
virtual E_TransferSyntax supportedTransferSyntax () const =0
 returns the transfer syntax that this particular codec is able to decode. More...
 
virtual OFBool isLosslessProcess () const =0
 returns true if the transfer syntax supported by this codec is lossless. More...
 
- Public Member Functions inherited from DcmCodec
 DcmCodec ()
 default constructor
 
virtual ~DcmCodec ()
 destructor
 

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. More...
 

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DcmCodec
static OFCondition insertStringIfMissing (DcmItem *dataset, const DcmTagKey &tag, const char *val)
 helper function that inserts a string attribute with a given value into a dataset if missing in the dataset. More...
 
static OFCondition convertToSecondaryCapture (DcmItem *dataset)
 helper function that converts a dataset containing a DICOM image into a valid (standard extended) Secondary Capture object by inserting all attributes that are type 1/2 in Secondary Capture and missing in the source dataset. More...
 
static OFCondition newInstance (DcmItem *dataset, const char *purposeOfReferenceCodingScheme=NULL, const char *purposeOfReferenceCodeValue=NULL, const char *purposeOfReferenceCodeMeaning=NULL)
 create new SOP instance UID and Source Image Sequence referencing the old SOP instance (if present) More...
 
static OFCondition updateImageType (DcmItem *dataset)
 set first value of Image Type to DERIVED. More...
 
static OFCondition insertCodeSequence (DcmItem *dataset, const DcmTagKey &tagKey, const char *codingSchemeDesignator, const char *codeValue, const char *codeMeaning)
 insert code sequence into the given dataset More...
 
static OFCondition determineStartFragment (Uint32 frameNo, Sint32 numberOfFrames, DcmPixelSequence *fromPixSeq, Uint32 &currentItem)
 determine the index number (starting with zero) of the compressed pixel data fragment corresponding to the given frame (also starting with zero) More...
 

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.

Member Function Documentation

◆ canChangeCoding()

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
oldRepTypecurrent transfer syntax
newRepTypedesired new transfer syntax
Returns
true if transformation is supported by this codec, false otherwise.

Implements DcmCodec.

◆ createDecoderInstance()

virtual DJDecoder* DJCodecDecoder::createDecoderInstance ( const DcmRepresentationParameter toRepParam,
const DJCodecParameter cp,
Uint8  bitsPerSample,
OFBool  isYBR 
) const
privatepure virtual

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

Parameters
toRepParamrepresentation parameter passed to decode()
cpcodec parameter passed to decode()
bitsPerSamplebits per sample for the image data
isYBRflag indicating whether DICOM photometric interpretation is YCbCr
Returns
pointer to newly allocated decoder object

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

◆ createPlanarConfigurationByte()

static OFCondition DJCodecDecoder::createPlanarConfigurationByte ( Uint8 *  imageFrame,
Uint16  columns,
Uint16  rows 
)
staticprivate

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

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

◆ createPlanarConfigurationWord()

static OFCondition DJCodecDecoder::createPlanarConfigurationWord ( Uint16 *  imageFrame,
Uint16  columns,
Uint16  rows 
)
staticprivate

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

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

◆ decode()

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
fromRepParamcurrent representation parameter of compressed data, may be NULL
pixSeqcompressed pixel sequence
uncompressedPixelDatauncompressed pixel data stored in this element
cpcodec parameters for this codec
objStackstack pointing to the location of the pixel data element in the current dataset.
Returns
EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

◆ decodeFrame()

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
fromParamrepresentation parameter of current compressed representation, may be NULL.
fromPixSeqcompressed pixel sequence
cpcodec parameters for this codec
datasetpointer to dataset in which pixel data element is contained
frameNonumber of frame, starting with 0 for the first frame
startFragmentindex 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.
bufferpointer to buffer where frame is to be stored
bufSizesize of buffer in bytes
decompressedColorModelupon 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.

◆ determineDecompressedColorModel()

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
fromParamrepresentation parameter of current compressed representation, may be NULL
fromPixSeqcompressed pixel sequence
cpcodec parameters for this codec
datasetpointer to dataset in which pixel data element is contained
datasetpointer to DICOM dataset in which this pixel data object is located. Used to access photometric interpretation.
decompressedColorModelupon 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.

◆ encode() [1/2]

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
pixelDatapointer to the uncompressed image data in OW format and local byte order
lengthof the pixel data field in bytes
toRepParamrepresentation parameter describing the desired compressed representation (e.g. JPEG quality)
pixSeqcompressed pixel sequence (pointer to new DcmPixelSequence object allocated on heap) returned in this parameter upon success.
cpcodec parameters for this codec
objStackstack pointing to the location of the pixel data element in the current dataset.
Returns
EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

◆ encode() [2/2]

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
fromRepTypecurrent transfer syntax of the compressed image
fromRepParamcurrent representation parameter of compressed data, may be NULL
fromPixSeqcompressed pixel sequence
toRepParamrepresentation parameter describing the desired new compressed representation (e.g. JPEG quality)
toPixSeqcompressed pixel sequence (pointer to new DcmPixelSequence object allocated on heap) returned in this parameter upon success.
cpcodec parameters for this codec
objStackstack pointing to the location of the pixel data element in the current dataset.
Returns
EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

◆ isLosslessProcess()

virtual OFBool DJCodecDecoder::isLosslessProcess ( ) const
pure virtual

returns true if the transfer syntax supported by this codec is lossless.

Returns
lossless flag

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

◆ readUint16()

static Uint16 DJCodecDecoder::readUint16 ( const Uint8 *  data)
staticprivate

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

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

◆ requiresPlanarConfiguration()

static OFBool DJCodecDecoder::requiresPlanarConfiguration ( const char *  sopClassUID,
EP_Interpretation  photometricInterpretation 
)
staticprivate

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
sopClassUIDSOP Class UID
photometricInterpretationdecompressed photometric interpretation
Returns
true if color-by-plane is required, false otherwise.

◆ scanJpegDataForBitDepth()

static Uint8 DJCodecDecoder::scanJpegDataForBitDepth ( const Uint8 *  data,
const Uint32  fragmentLength 
)
staticprivate

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
datapointer to array, must not be NULL
fragmentLengthsize of array
Returns
bit depth of JPEG data, 0 if no SOF marker found or parse error

◆ supportedTransferSyntax()

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 DJDecoderExtended, DJDecoderLossless, DJDecoderProgressive, DJDecoderSpectralSelection, DJDecoderP14SV1, and DJDecoderBaseline.


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


Generated on Thu Nov 29 2018 for DCMTK Version 3.6.4 by Doxygen 1.8.14