DCMTK: DJLSDecoderBase Class Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
DJLSDecoderBase Class Referenceabstract

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

Inheritance diagram for DJLSDecoderBase:

## 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, OFBool &removeOldRep) 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, OFBool &removeOldRep) 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, OFBool &removeOldRep) 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 Uint16 | decodedBitsAllocated (Uint16 bitsAllocated, Uint16 bitsStored) const
| determines the effective value of BitsAllocated that a dataset will have after decompression of an image with the given values for bitsAllocated and bitsStored.
virtual OFCondition | determineDecompressedColorModel (const DcmRepresentationParameter *fromParam, DcmPixelSequence *fromPixSeq, const DcmCodecParameter *cp, DcmItem *dataset, OFString &decompressedColorModel) const
| determine color model of the decompressed image
Public Member Functions inherited from DcmCodec
| DcmCodec ()
| default constructor
virtual | ~DcmCodec ()
| destructor

## Private Member Functions
virtual E_TransferSyntax | supportedTransferSyntax () const =0
| returns the transfer syntax that this particular codec is able to Decode

## 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 OFCondition | decodeFrameNoSwap (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, without adjusting byte order
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.

## 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.
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.
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)
static OFCondition | updateImageType (DcmItem *dataset)
| update value of the Image Type element (if needed).
static OFCondition | insertCodeSequence (DcmItem *dataset, const DcmTagKey &tagKey, const char *codingSchemeDesignator, const char *codeValue, const char *codeMeaning)
| insert code sequence into the given dataset
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)

## 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

## ◆ canChangeCoding()

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

  oldRepType | current transfer syntax
  newRepType | desired new transfer syntax

Returns
  true if transformation is supported by this codec, false otherwise.

Implements DcmCodec.

## ◆ computeNumberOfFragments()

Uint32 DJLSDecoderBase::computeNumberOfFragments | ( | Sint32 | numberOfFrames,
|  | Uint32 | currentFrame,
|  | Uint32 | startItem,
|  | OFBool | ignoreOffsetTable,
|  | DcmPixelSequence * | pixSeq )
| staticprivate

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

  numberOfFrames | total number of frames of the DICOM object
  currentFrame | index of current frame (0..numberOfFrames-1)
  startItem | index of fragment (pixel item) the frame starts with
  ignoreOffsetTable | flag instructing the method to ignore the offset table even if present and presumably useful
  pixSeq | the compressed JPEG-LS pixel sequence

Returns
  number of fragments for the current frame, zero upon error

## ◆ createPlanarConfiguration0Byte()

OFCondition DJLSDecoderBase::createPlanarConfiguration0Byte | ( | Uint8 * | imageFrame,
|  | Uint16 | columns,
|  | Uint16 | rows )
| staticprivate

converts an RGB or YBR frame with 8 bits/sample from color-by-plane to color-by-pixel 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

## ◆ createPlanarConfiguration0Word()

OFCondition DJLSDecoderBase::createPlanarConfiguration0Word | ( | Uint16 * | imageFrame,
|  | Uint16 | columns,
|  | Uint16 | rows )
| staticprivate

converts an RGB or YBR frame with 16 bits/sample from color-by-plane to color-by-pixel 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

## ◆ createPlanarConfiguration1Byte()

OFCondition DJLSDecoderBase::createPlanarConfiguration1Byte | ( | 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

  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

## ◆ createPlanarConfiguration1Word()

OFCondition DJLSDecoderBase::createPlanarConfiguration1Word | ( | 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

  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

## ◆ decode()

virtual OFCondition DJLSDecoderBase::decode | ( | const DcmRepresentationParameter * | fromRepParam,
|  | DcmPixelSequence * | pixSeq,
|  | DcmPolymorphOBOW & | uncompressedPixelData,
|  | const DcmCodecParameter * | cp,
|  | const DcmStack & | objStack,
|  | OFBool & | removeOldRep ) 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.
  removeOldRep | boolean flag that should be set to false before this method call and will be set to true if the codec modifies the DICOM dataset such that the pixel data of the original representation may not be usable anymore.

Returns
  EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

## ◆ decodedBitsAllocated()

virtual Uint16 DJLSDecoderBase::decodedBitsAllocated | ( | Uint16 | bitsAllocated,
|  | Uint16 | bitsStored ) const
| virtual

determines the effective value of BitsAllocated that a dataset will have after decompression of an image with the given values for bitsAllocated and bitsStored.

This may differ from the bitsAllocated parameter for example if that value is not a multiple of 8. Returns zero if an image with the given parameters cannot be decoded with this codec.

Parameters

  bitsAllocated | current value of Bits Allocated
  bitsStored | current value of Bits Stored

Returns
  value of BitsAllocated after decompression, 0 if no decompression possible

Implements DcmCodec.

## ◆ decodeFrame() [1/2]

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

  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.

## ◆ decodeFrame() [2/2]

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 )
| staticprivate

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

Parameters

  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
  imageFrames | number of frames in this image
  imageColumns | number of columns for each frame
  imageRows | number of rows for each frame
  imageSamplesPerPixel | number of samples per pixel
  bytesPerSample | number of bytes per sample

Returns
  EC_Normal if successful, an error code otherwise.

## ◆ decodeFrameNoSwap()

OFCondition DJLSDecoderBase::decodeFrameNoSwap | ( | 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 )
| staticprivate

decompresses a single frame from the given pixel sequence and stores the result in the given buffer, without adjusting byte order

Parameters

  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
  imageFrames | number of frames in this image
  imageColumns | number of columns for each frame
  imageRows | number of rows for each frame
  imageSamplesPerPixel | number of samples per pixel
  bytesPerSample | number of bytes per sample

Returns
  EC_Normal if successful, an error code otherwise.

## ◆ determineDecompressedColorModel()

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

  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.

## ◆ determinePlanarConfiguration()

Uint16 DJLSDecoderBase::determinePlanarConfiguration | ( | const OFString & | sopClassUID,
|  | const OFString & | photometricInterpretation )
| staticprivate

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

  sopClassUID | SOP Class UID
  photometricInterpretation | decompressed photometric interpretation

Returns
  legal value for planar configuration

## ◆ encode() [1/2]

virtual OFCondition DJLSDecoderBase::encode | ( | const E_TransferSyntax | fromRepType,
|  | const DcmRepresentationParameter * | fromRepParam,
|  | DcmPixelSequence * | fromPixSeq,
|  | const DcmRepresentationParameter * | toRepParam,
|  | DcmPixelSequence *& | toPixSeq,
|  | const DcmCodecParameter * | cp,
|  | DcmStack & | objStack,
|  | OFBool & | removeOldRep ) 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.
  removeOldRep | boolean flag that should be set to false before this method call and will be set to true if the codec modifies the DICOM dataset such that the pixel data of the original representation may not be usable anymore.

Returns
  EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

## ◆ encode() [2/2]

virtual OFCondition DJLSDecoderBase::encode | ( | const Uint16 * | pixelData,
|  | const Uint32 | length,
|  | const DcmRepresentationParameter * | toRepParam,
|  | DcmPixelSequence *& | pixSeq,
|  | const DcmCodecParameter * | cp,
|  | DcmStack & | objStack,
|  | OFBool & | removeOldRep ) 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.
  removeOldRep | boolean flag that should be set to false before this method call and will be set to true if the codec modifies the DICOM dataset such that the pixel data of the original representation may not be usable anymore.

Returns
  EC_Normal if successful, an error code otherwise.

Implements DcmCodec.

## ◆ isJPEGLSStartOfImage()

OFBool DJLSDecoderBase::isJPEGLSStartOfImage | ( | Uint8 * | fragmentData | ) |
| staticprivate

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

Parameters

  fragmentData | pointer 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.

## ◆ supportedTransferSyntax()

virtual E_TransferSyntax DJLSDecoderBase::supportedTransferSyntax | ( |  | ) | const
| privatepure virtual

returns the transfer syntax that this particular codec is able to Decode

Returns
  supported transfer syntax

Implemented in DJLSLosslessDecoder, and DJLSNearLosslessDecoder.

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

- dcmjpls/include/dcmtk/dcmjpls/djcodecd.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1