DCMTK  Version 3.6.1 20120515
OFFIS DICOM Toolkit
Public Member Functions | Static Private Member Functions
DJLSDecoderBase Class Reference

abstract codec class for JPEG-LS decoders. More...

+ Inheritance diagram for DJLSDecoderBase:

List of all members.

Public Member Functions

 DJLSDecoderBase ()
 default constructor
virtual ~DJLSDecoderBase ()
 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

Static Private Member Functions

static OFCondition decodeFrame (DcmPixelSequence *fromPixSeq, const DJLSCodecParameter *cp, DcmItem *dataset, Uint32 frameNo, Uint32 &startFragment, void *buffer, Uint32 bufSize, Sint32 imageFrames, Uint16 imageColumns, Uint16 imageRows, Uint16 imageSamplesPerPixel, Uint16 bytesPerSample)
 decompresses a single frame from the given pixel sequence and stores the result in the given buffer.
static Uint16 determinePlanarConfiguration (const OFString &sopClassUID, const OFString &photometricInterpretation)
 determines if a given image requires color-by-plane planar configuration depending on SOP Class UID (DICOM IOD) and photometric interpretation.
static Uint32 computeNumberOfFragments (Sint32 numberOfFrames, Uint32 currentFrame, Uint32 startItem, OFBool ignoreOffsetTable, DcmPixelSequence *pixSeq)
 computes the number of fragments (pixel items) that comprise the current frame in the compressed pixel sequence.
static OFBool isJPEGLSStartOfImage (Uint8 *fragmentData)
 check whether the given buffer contains a JPEG-LS start-of-image code
static OFCondition createPlanarConfiguration1Byte (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 createPlanarConfiguration1Word (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 OFCondition createPlanarConfiguration0Byte (Uint8 *imageFrame, Uint16 columns, Uint16 rows)
 converts an RGB or YBR frame with 8 bits/sample from color-by-plane to color-by-pixel planar configuration.
static OFCondition createPlanarConfiguration0Word (Uint16 *imageFrame, Uint16 columns, Uint16 rows)
 converts an RGB or YBR frame with 16 bits/sample from color-by-plane to color-by-pixel planar configuration.

Detailed Description

abstract codec class for JPEG-LS decoders.

This abstract class contains most of the application logic needed for a dcmdata codec object that implements a JPEG-LS decoder. This class only supports decompression, it neither implements encoding nor transcoding.


Member Function Documentation

virtual OFBool DJLSDecoderBase::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.

static Uint32 DJLSDecoderBase::computeNumberOfFragments ( Sint32  numberOfFrames,
Uint32  currentFrame,
Uint32  startItem,
OFBool  ignoreOffsetTable,
DcmPixelSequence pixSeq 
) [static, private]

computes the number of fragments (pixel items) that comprise the current frame in the compressed pixel sequence.

This method uses various approaches to compute the number of fragments for a frame, including a check of the offset table and checking the start of each fragment for JPEG SOI markers.

Parameters:
numberOfFramestotal number of frames of the DICOM object
currentFrameindex of current frame (0..numberOfFrames-1)
startItemindex of fragment (pixel item) the frame starts with
ignoreOffsetTableflag instructing the method to ignore the offset table even if present and presumably useful
pixSeqthe compressed JPEG-LS pixel sequence
Returns:
number of fragments for the current frame, zero upon error
static OFCondition DJLSDecoderBase::createPlanarConfiguration0Byte ( Uint8 *  imageFrame,
Uint16  columns,
Uint16  rows 
) [static, private]

converts an RGB or YBR frame with 8 bits/sample from color-by-plane to color-by-pixel 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
static OFCondition DJLSDecoderBase::createPlanarConfiguration0Word ( Uint16 *  imageFrame,
Uint16  columns,
Uint16  rows 
) [static, private]

converts an RGB or YBR frame with 16 bits/sample from color-by-plane to color-by-pixel 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
static OFCondition DJLSDecoderBase::createPlanarConfiguration1Byte ( 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:
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
static OFCondition DJLSDecoderBase::createPlanarConfiguration1Word ( 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:
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
virtual OFCondition DJLSDecoderBase::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.

virtual OFCondition DJLSDecoderBase::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.

static OFCondition DJLSDecoderBase::decodeFrame ( DcmPixelSequence fromPixSeq,
const DJLSCodecParameter cp,
DcmItem dataset,
Uint32  frameNo,
Uint32 &  startFragment,
void *  buffer,
Uint32  bufSize,
Sint32  imageFrames,
Uint16  imageColumns,
Uint16  imageRows,
Uint16  imageSamplesPerPixel,
Uint16  bytesPerSample 
) [static, private]

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

Parameters:
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
imageFramesnumber of frames in this image
imageColumnsnumber of columns for each frame
imageRowsnumber of rows for each frame
imageSamplesPerPixelnumber of samples per pixel
bytesPerSamplenumber of bytes per sample
Returns:
EC_Normal if successful, an error code otherwise.
virtual OFCondition DJLSDecoderBase::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.

static Uint16 DJLSDecoderBase::determinePlanarConfiguration ( const OFString sopClassUID,
const OFString photometricInterpretation 
) [static, private]

determines 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:
legal value for planar configuration
virtual OFCondition DJLSDecoderBase::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.

virtual OFCondition DJLSDecoderBase::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.

static OFBool DJLSDecoderBase::isJPEGLSStartOfImage ( Uint8 *  fragmentData) [static, private]

check whether the given buffer contains a JPEG-LS start-of-image code

Parameters:
fragmentDatapointer to 4 or more bytes of JPEG-LS data
Returns:
true if the first four bytes of the code stream indicate that this fragment is the start of a new JPEG-LS image, i.e. starts with an SOI marker followed by SOF, COM or APPn.

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


Generated on Tue May 15 2012 for DCMTK Version 3.6.1 20120515 by Doxygen 1.7.5.1-20111027