DJCodecEncoder Class Reference

abstract codec class for JPEG encoders. More...

Inheritance diagram for DJCodecEncoder:

DcmCodec DJEncoderBaseline DJEncoderExtended DJEncoderLossless DJEncoderP14SV1 DJEncoderProgressive DJEncoderSpectralSelection List of all members.

Public Member Functions

 DJCodecEncoder ()
 default constructor
virtual ~DJCodecEncoder ()
 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 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 E_TransferSyntax supportedTransferSyntax () const =0
 returns the transfer syntax that this particular codec is able to encode and decode.

Static Protected Member Functions

static void appendCompressionRatio (OFString &arg, double ratio)
 format compression ratio as string and append to given string object.
static OFCondition togglePlanarConfiguration8 (Uint8 *pixelData, const unsigned long numValues, const Uint16 samplesPerPixel, const Uint16 oldPlanarConfig)
 toggles Planar Configuration of 8-bit pixel data from "by pixel" to "by plane" and vice versa.
static OFCondition togglePlanarConfiguration16 (Uint16 *pixelData, const unsigned long numValues, const Uint16 samplesPerPixel, const Uint16 oldPlanarConfig)
 toggles Planar Configuration of 16-bit pixel data from "by pixel" to "by plane" and vice versa.

Private Member Functions

virtual OFCondition encodeColorImage (OFBool YBRmode, DcmItem *dataset, const DcmRepresentationParameter *toRepParam, DcmPixelSequence *&pixSeq, const DJCodecParameter *cp, double &compressionRatio) const
 compresses the given uncompressed DICOM color image and stores the result in the given pixSeq element.
virtual OFCondition encodeMonochromeImage (DcmItem *dataset, const DcmRepresentationParameter *toRepParam, DcmPixelSequence *&pixSeq, const DJCodecParameter *cp, double &compressionRatio) const
 compresses the given uncompressed monochrome DICOM image and stores the result in the given pixSeq element.
virtual OFCondition encodeTrueLossless (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 updateLossyCompressionRatio (DcmItem *dataset, double ratio) const
 create Lossy Image Compression and Lossy Image Compression Ratio.
virtual OFCondition updateDerivationDescription (DcmItem *dataset, const DcmRepresentationParameter *toRepParam, const DJCodecParameter *cp, Uint8 bitsPerSample, double ratio) const
 create Derivation Description.
virtual OFCondition adjustOverlays (DcmItem *dataset, DicomImage &image) const
 for all overlay groups create (60xx,3000) Overlay Data.
virtual OFBool isLosslessProcess () const =0
 returns true if the transfer syntax supported by this codec is lossless.
virtual void createDerivationDescription (const DcmRepresentationParameter *toRepParam, const DJCodecParameter *cp, Uint8 bitsPerSample, double ratio, OFString &derivationDescription) const =0
 creates 'derivation description' string after encoding.
virtual DJEncodercreateEncoderInstance (const DcmRepresentationParameter *toRepParam, const DJCodecParameter *cp, Uint8 bitsPerSample) const =0
 creates an instance of the compression library to be used for encoding/decoding.
OFCondition updatePlanarConfiguration (DcmItem *item, const Uint16 newPlanConf) const

Static Private Member Functions

static OFCondition correctVOIWindows (DcmItem *dataset, double voiOffset, double voiFactor)
 modifies all VOI window center/width settings in the image.

Detailed Description

abstract codec class for JPEG encoders.

This abstract class contains most of the application logic needed for a dcmdata codec object that implements a JPEG encoder using the DJEncoder interface to the underlying JPEG implementation. This class only supports compression, it neither implements decoding nor transcoding.

Definition at line 62 of file djcodece.h.


Member Function Documentation

virtual OFCondition DJCodecEncoder::adjustOverlays DcmItem dataset,
DicomImage image
const [private, virtual]
 

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

Parameters:
dataset dataset to be modified
image DicomImage object for this dataset
Returns:
EC_Normal if successful, an error code otherwise

static void DJCodecEncoder::appendCompressionRatio OFString arg,
double  ratio
[static, protected]
 

format compression ratio as string and append to given string object.

Parameters:
arg string to append to
ratio compression ratio

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

static OFCondition DJCodecEncoder::correctVOIWindows DcmItem dataset,
double  voiOffset,
double  voiFactor
[static, private]
 

modifies all VOI window center/width settings in the image.

Modifications are based on the pixel value mapping f(x) = (x+voiOffset)*voiFactor

Parameters:
dataset dataset to be updated
voiOffset offset to be added to each pixel
voiFactor factor to be multiplied
Returns:
EC_Normal if successful, an error code otherwise

virtual void DJCodecEncoder::createDerivationDescription const DcmRepresentationParameter toRepParam,
const DJCodecParameter cp,
Uint8  bitsPerSample,
double  ratio,
OFString derivationDescription
const [private, pure virtual]
 

creates 'derivation description' string after encoding.

Parameters:
toRepParam representation parameter passed to encode()
cp codec parameter passed to encode()
bitsPerSample bits per sample of the original image data prior to compression
ratio image compression ratio. This is not the "quality factor" but the real effective ratio between compressed and uncompressed image, i. e. 30 means a 30:1 lossy compression.
derivation description returned in this parameter which is initially empty

Implemented in DJEncoderBaseline, DJEncoderExtended, DJEncoderLossless, DJEncoderProgressive, DJEncoderSpectralSelection, and DJEncoderP14SV1.

virtual DJEncoder* DJCodecEncoder::createEncoderInstance const DcmRepresentationParameter toRepParam,
const DJCodecParameter cp,
Uint8  bitsPerSample
const [private, pure virtual]
 

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

Parameters:
toRepParam representation parameter passed to encode()
cp codec parameter passed to encode()
bitsPerSample bits per sample for the image data
Returns:
pointer to newly allocated codec object

Implemented in DJEncoderBaseline, DJEncoderExtended, DJEncoderLossless, DJEncoderProgressive, DJEncoderSpectralSelection, and DJEncoderP14SV1.

virtual OFCondition DJCodecEncoder::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 DJCodecEncoder::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 OFCondition DJCodecEncoder::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 DJCodecEncoder::encodeColorImage OFBool  YBRmode,
DcmItem dataset,
const DcmRepresentationParameter toRepParam,
DcmPixelSequence *&  pixSeq,
const DJCodecParameter cp,
double &  compressionRatio
const [private, virtual]
 

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

Parameters:
YBRmode true if the source image has YBR_FULL or YBR_FULL_422 photometric interpretation and can thus be compressed without color space conversion.
dataset DICOM dataset containing the pixel data as well as descriptive attributes
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
compressionRatio compression ratio returned in this parameter if successful.
Returns:
EC_Normal if successful, an error code otherwise.

virtual OFCondition DJCodecEncoder::encodeMonochromeImage DcmItem dataset,
const DcmRepresentationParameter toRepParam,
DcmPixelSequence *&  pixSeq,
const DJCodecParameter cp,
double &  compressionRatio
const [private, virtual]
 

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

Parameters:
dataset DICOM dataset containing the pixel data as well as descriptive attributes
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
compressionRatio compression ratio returned in this parameter if successful.
Returns:
EC_Normal if successful, an error code otherwise.

virtual OFCondition DJCodecEncoder::encodeTrueLossless const DcmRepresentationParameter toRepParam,
DcmPixelSequence *&  pixSeq,
const DcmCodecParameter cp,
DcmStack objStack
const [private, virtual]
 

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

No colorspace conversions, modality or windowing transformations are applied to guarantee, that the quality of the source image is fully preserved.

Parameters:
toRepParam - [in] representation parameter describing the desired
pixSeq - [out] compressed pixel sequence (pointer to new DcmPixelSequence object allocated on heap) returned in this parameter upon success
cp - [in] codec parameters for this codec
objStack - [in/out] stack pointing to the location of the pixel data element in the current dataset.
Returns:
EC_Normal if successful, an error code otherwise.

virtual OFBool DJCodecEncoder::isLosslessProcess  )  const [private, pure virtual]
 

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

Returns:
lossless flag

Implemented in DJEncoderBaseline, DJEncoderExtended, DJEncoderLossless, DJEncoderProgressive, DJEncoderSpectralSelection, and DJEncoderP14SV1.

virtual E_TransferSyntax DJCodecEncoder::supportedTransferSyntax  )  const [pure virtual]
 

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

Returns:
supported transfer syntax

Implemented in DJEncoderBaseline, DJEncoderExtended, DJEncoderLossless, DJEncoderProgressive, DJEncoderSpectralSelection, and DJEncoderP14SV1.

static OFCondition DJCodecEncoder::togglePlanarConfiguration16 Uint16 *  pixelData,
const unsigned long  numValues,
const Uint16  samplesPerPixel,
const Uint16  oldPlanarConfig
[static, protected]
 

toggles Planar Configuration of 16-bit pixel data from "by pixel" to "by plane" and vice versa.

Parameters:
pixelData - [in/out] Original pixel data (input), contains pixel data with toggled Planar configuration after returning (output).
numValues - [in] The number of 16 bit values in pixelData
samplesPerPixel - [in] Number of components for one pixel
oldPlanarConfig - [in] The old Planar Configuration, that should be toggled. 0 means "by pixel", 1 "by color"
Returns:
EC_Normal, if conversion was successful; error else

static OFCondition DJCodecEncoder::togglePlanarConfiguration8 Uint8 *  pixelData,
const unsigned long  numValues,
const Uint16  samplesPerPixel,
const Uint16  oldPlanarConfig
[static, protected]
 

toggles Planar Configuration of 8-bit pixel data from "by pixel" to "by plane" and vice versa.

Parameters:
pixelData - [in/out] Original pixel data (input), contains pixel data with toggled Planar configuration after returning (output).
numValues - [in] The number of 8 bit values in pixelData
samplesPerPixel - [in] Number of components for one pixel
oldPlanarConfig - [in] The old Planar Configuration, that should be toggled. 0 means "by pixel", 1 "by color"
Returns:
EC_Normal, if conversion was successful; error else

virtual OFCondition DJCodecEncoder::updateDerivationDescription DcmItem dataset,
const DcmRepresentationParameter toRepParam,
const DJCodecParameter cp,
Uint8  bitsPerSample,
double  ratio
const [private, virtual]
 

create Derivation Description.

Parameters:
dataset dataset to be modified
toRepParam representation parameter passed to encode()
cp codec parameter passed to encode()
bitsPerSample bits per sample of the original image data prior to compression
ratio image compression ratio. This is not the "quality factor" but 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

virtual OFCondition DJCodecEncoder::updateLossyCompressionRatio DcmItem dataset,
double  ratio
const [private, virtual]
 

create Lossy Image Compression and Lossy Image Compression Ratio.

Parameters:
dataset dataset to be modified
ratio image compression ratio > 1. This is not the "quality factor" but 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 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5