DCMTK  Version 3.6.1 20170228
OFFIS DICOM Toolkit
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | List of all members
DJLSEncoderBase Class Referenceabstract

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

+ Inheritance diagram for DJLSEncoderBase:

Public Member Functions

 DJLSEncoderBase ()
 default constructor
 
virtual ~DJLSEncoderBase ()
 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...
 
- 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 encode More...
 
OFCondition losslessRawEncode (const Uint16 *pixelData, const Uint32 length, DcmItem *dataset, const DJLSRepresentationParameter *djrp, DcmPixelSequence *&pixSeq, const DJLSCodecParameter *djcp, double &compressionRatio) const
 lossless encoder that compresses the complete pixel cell (very much like the RLE encoder in module dcmdata). More...
 
OFCondition losslessCookedEncode (const Uint16 *pixelData, const Uint32 length, DcmItem *dataset, const DJLSRepresentationParameter *djrp, DcmPixelSequence *&pixSeq, const DJLSCodecParameter *djcp, double &compressionRatio, Uint16 nearLosslessDeviation) const
 lossless encoder that moves Overlays to (60xx,3000) and only compresses the stored bits of the pixel cell. More...
 
OFCondition adjustOverlays (DcmItem *dataset, DicomImage &image) const
 for all overlay groups create (60xx,3000) Overlay Data. More...
 
OFCondition updateLossyCompressionRatio (DcmItem *dataset, double ratio) const
 create Lossy Image Compression and Lossy Image Compression Ratio. More...
 
OFCondition updateDerivationDescription (DcmItem *dataset, const DJLSRepresentationParameter *djrp, double ratio) const
 create Derivation Description. More...
 
OFCondition compressRawFrame (const Uint8 *framePointer, Uint16 bitsAllocated, Uint16 columns, Uint16 rows, Uint16 samplesPerPixel, Uint16 planarConfiguration, const OFString &photometricInterpretation, DcmPixelSequence *pixelSequence, DcmOffsetList &offsetList, unsigned long &compressedSize, const DJLSCodecParameter *djcp) const
 perform the lossless raw compression of a single frame More...
 
OFCondition compressCookedFrame (DcmPixelSequence *pixelSequence, DicomImage *dimage, const OFString &photometricInterpretation, DcmOffsetList &offsetList, unsigned long &compressedSize, const DJLSCodecParameter *djcp, Uint32 frame, Uint16 nearLosslessDeviation) const
 perform the lossless cooked compression of a single frame More...
 
OFCondition convertToUninterleaved (Uint8 *target, const Uint8 *source, Uint16 components, Uint32 width, Uint32 height, Uint16 bitsAllocated) const
 Convert an image from sample interleaved to uninterleaved. More...
 
OFCondition convertToSampleInterleaved (Uint8 *target, const Uint8 *source, Uint16 components, Uint32 width, Uint32 height, Uint16 bitsAllocated) const
 Convert an image from uninterleaved to sample interleaved. 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-LS encoders.

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

Member Function Documentation

OFCondition DJLSEncoderBase::adjustOverlays ( DcmItem dataset,
DicomImage image 
) const
private

for all overlay groups create (60xx,3000) Overlay Data.

Parameters
datasetdataset to be modified
imageDicomImage object for this dataset
Returns
EC_Normal if successful, an error code otherwise
virtual OFBool DJLSEncoderBase::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.

OFCondition DJLSEncoderBase::compressCookedFrame ( DcmPixelSequence pixelSequence,
DicomImage dimage,
const OFString photometricInterpretation,
DcmOffsetList offsetList,
unsigned long &  compressedSize,
const DJLSCodecParameter djcp,
Uint32  frame,
Uint16  nearLosslessDeviation 
) const
private

perform the lossless cooked compression of a single frame

Parameters
pixelSequenceobject in which the compressed frame is stored
dimageDicomImage instance used to process frame
photometricInterpretationphotometric interpretation of the DICOM dataset
offsetListlist of frame offsets updated in this parameter
compressedSizesize of compressed frame returned in this parameter
djcpparameters for the codec
frameframe index
nearLosslessDeviationmaximum deviation for near-lossless encoding
Returns
EC_Normal if successful, an error code otherwise
OFCondition DJLSEncoderBase::compressRawFrame ( const Uint8 *  framePointer,
Uint16  bitsAllocated,
Uint16  columns,
Uint16  rows,
Uint16  samplesPerPixel,
Uint16  planarConfiguration,
const OFString photometricInterpretation,
DcmPixelSequence pixelSequence,
DcmOffsetList offsetList,
unsigned long &  compressedSize,
const DJLSCodecParameter djcp 
) const
private

perform the lossless raw compression of a single frame

Parameters
framePointerpointer to start of frame
bitsAllocatednumber of bits allocated per pixel
columnsframe width
rowsframe height
samplesPerPixelimage samples per pixel
planarConfigurationimage planar configuration
photometricInterpretationphotometric interpretation of the DICOM dataset
pixelSequenceobject in which the compressed frame is stored
offsetListlist of frame offsets updated in this parameter
compressedSizesize of compressed frame returned in this parameter
djcpparameters for the codec
Returns
EC_Normal if successful, an error code otherwise
OFCondition DJLSEncoderBase::convertToSampleInterleaved ( Uint8 *  target,
const Uint8 *  source,
Uint16  components,
Uint32  width,
Uint32  height,
Uint16  bitsAllocated 
) const
private

Convert an image from uninterleaved to sample interleaved.

Parameters
targetA buffer where the converted image will be stored
sourceThe image buffer to be converted
componentsColor components used in the image
widthThe width of the image.
heightThe height of the image.
bitsAllocatedThe number of bits allocated in the image.
Returns
EC_Normal if succesful, an error code otherwise
OFCondition DJLSEncoderBase::convertToUninterleaved ( Uint8 *  target,
const Uint8 *  source,
Uint16  components,
Uint32  width,
Uint32  height,
Uint16  bitsAllocated 
) const
private

Convert an image from sample interleaved to uninterleaved.

Parameters
targetA buffer where the converted image will be stored
sourceThe image buffer to be converted
componentsColor components used in the image
widthThe width of the image
heightThe height of the image
bitsAllocatedThe number of bits allocated in the image.
Returns
EC_Normal if succesful, an error code otherwise
virtual OFCondition DJLSEncoderBase::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 DJLSEncoderBase::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.

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

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

OFCondition DJLSEncoderBase::losslessCookedEncode ( const Uint16 *  pixelData,
const Uint32  length,
DcmItem dataset,
const DJLSRepresentationParameter djrp,
DcmPixelSequence *&  pixSeq,
const DJLSCodecParameter djcp,
double &  compressionRatio,
Uint16  nearLosslessDeviation 
) const
private

lossless encoder that moves Overlays to (60xx,3000) and only compresses the stored bits of the pixel cell.

Parameters
pixelDatapointer to the uncompressed image data in OW format and local byte order
lengthof the pixel data field in bytes
datasetpointer to dataset containing image pixel module
djrprepresentation parameter
pixSeqpixel sequence to write to
djcpcodec parameter
compressionRatiocompression ratio returned upon success
nearLosslessDeviationmaximum deviation for near-lossless encoding
Returns
EC_Normal if successful, an error code otherwise.
OFCondition DJLSEncoderBase::losslessRawEncode ( const Uint16 *  pixelData,
const Uint32  length,
DcmItem dataset,
const DJLSRepresentationParameter djrp,
DcmPixelSequence *&  pixSeq,
const DJLSCodecParameter djcp,
double &  compressionRatio 
) const
private

lossless encoder that compresses the complete pixel cell (very much like the RLE encoder in module dcmdata).

Parameters
pixelDatapointer to the uncompressed image data in OW format and local byte order
lengthof the pixel data field in bytes
datasetpointer to dataset containing image pixel module
djrprepresentation parameter
pixSeqpixel sequence to write to
djcpcodec parameter
compressionRatiocompression ratio returned upon success
Returns
EC_Normal if successful, an error code otherwise.
virtual E_TransferSyntax DJLSEncoderBase::supportedTransferSyntax ( ) const
privatepure virtual

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

Returns
supported transfer syntax

Implemented in DJLSNearLosslessEncoder, and DJLSLosslessEncoder.

OFCondition DJLSEncoderBase::updateDerivationDescription ( DcmItem dataset,
const DJLSRepresentationParameter djrp,
double  ratio 
) const
private

create Derivation Description.

Parameters
datasetdataset to be modified
djrprepresentation parameter passed to encode()
ratioimage compression ratio > 1. This is the real effective ratio between compressed and uncompressed image, i. e. 30 means a 30:1 lossy compression.
Returns
EC_Normal if successful, an error code otherwise
OFCondition DJLSEncoderBase::updateLossyCompressionRatio ( DcmItem dataset,
double  ratio 
) const
private

create Lossy Image Compression and Lossy Image Compression Ratio.

Parameters
datasetdataset to be modified
ratioimage compression ratio > 1. This is the real effective ratio between compressed and uncompressed image, i. e. 30 means a 30:1 lossy compression.
Returns
EC_Normal if successful, an error code otherwise

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


Generated on Tue Feb 28 2017 for DCMTK Version 3.6.1 20170228 by Doxygen 1.8.8