OFFIS DCMTK  Version 3.6.0
djcodece.h
1 /*
2  *
3  * Copyright (C) 2007-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmjpls
15  *
16  * Author: Martin Willkomm, Uli Schlachter
17  *
18  * Purpose: codec classes for JPEG-LS encoders.
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:17:19 $
22  * CVS/RCS Revision: $Revision: 1.8 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCMJPLS_DJCODEC_H
30 #define DCMJPLS_DJCODEC_H
31 
32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/dcmdata/dccodec.h" /* for class DcmCodec */
34 #include "dcmtk/dcmdata/dcofsetl.h" /* for struct DcmOffsetList */
35 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */
36 
38 class DJLSCodecParameter;
39 class DicomImage;
40 
47 class DJLSEncoderBase : public DcmCodec
48 {
49 public:
50 
53 
55  virtual ~DJLSEncoderBase();
56 
67  virtual OFCondition decode(
68  const DcmRepresentationParameter * fromRepParam,
69  DcmPixelSequence * pixSeq,
70  DcmPolymorphOBOW& uncompressedPixelData,
71  const DcmCodecParameter * cp,
72  const DcmStack& objStack) const;
73 
99  virtual OFCondition decodeFrame(
100  const DcmRepresentationParameter * fromParam,
101  DcmPixelSequence * fromPixSeq,
102  const DcmCodecParameter * cp,
103  DcmItem *dataset,
104  Uint32 frameNo,
105  Uint32& startFragment,
106  void *buffer,
107  Uint32 bufSize,
108  OFString& decompressedColorModel) const;
109 
124  virtual OFCondition encode(
125  const Uint16 * pixelData,
126  const Uint32 length,
127  const DcmRepresentationParameter * toRepParam,
128  DcmPixelSequence * & pixSeq,
129  const DcmCodecParameter *cp,
130  DcmStack & objStack) const;
131 
146  virtual OFCondition encode(
147  const E_TransferSyntax fromRepType,
148  const DcmRepresentationParameter * fromRepParam,
149  DcmPixelSequence * fromPixSeq,
150  const DcmRepresentationParameter * toRepParam,
151  DcmPixelSequence * & toPixSeq,
152  const DcmCodecParameter * cp,
153  DcmStack & objStack) const;
154 
162  virtual OFBool canChangeCoding(
163  const E_TransferSyntax oldRepType,
164  const E_TransferSyntax newRepType) const;
165 
180  const DcmRepresentationParameter *fromParam,
181  DcmPixelSequence *fromPixSeq,
182  const DcmCodecParameter *cp,
183  DcmItem *dataset,
184  OFString &decompressedColorModel) const;
185 
186 private:
187 
192  virtual E_TransferSyntax supportedTransferSyntax() const = 0;
193 
207  const Uint16 *pixelData,
208  const Uint32 length,
209  DcmItem *dataset,
210  const DJLSRepresentationParameter *djrp,
211  DcmPixelSequence * & pixSeq,
212  const DJLSCodecParameter *djcp,
213  double& compressionRatio) const;
214 
229  const Uint16 * pixelData,
230  const Uint32 length,
231  DcmItem *dataset,
232  const DJLSRepresentationParameter *djrp,
233  DcmPixelSequence * & pixSeq,
234  const DJLSCodecParameter *djcp,
235  double& compressionRatio,
236  Uint16 nearLosslessDeviation) const;
237 
244  DcmItem *dataset,
245  DicomImage& image) const;
246 
255  DcmItem *dataset,
256  double ratio) const;
257 
267  DcmItem *dataset,
268  const DJLSRepresentationParameter *djrp,
269  double ratio) const;
270 
286  const Uint8 *framePointer,
287  Uint16 bitsAllocated,
288  Uint16 columns,
289  Uint16 rows,
290  Uint16 samplesPerPixel,
291  Uint16 planarConfiguration,
292  const OFString& photometricInterpretation,
293  DcmPixelSequence *pixelSequence,
294  DcmOffsetList &offsetList,
295  unsigned long &compressedSize,
296  const DJLSCodecParameter *djcp) const;
297 
310  DcmPixelSequence *pixelSequence,
311  DicomImage *dimage,
312  const OFString& photometricInterpretation,
313  DcmOffsetList &offsetList,
314  unsigned long &compressedSize,
315  const DJLSCodecParameter *djcp,
316  Uint32 frame,
317  Uint16 nearLosslessDeviation) const;
318 
329  Uint8 *target,
330  const Uint8 *source,
331  Uint16 components,
332  Uint32 width,
333  Uint32 height,
334  Uint16 bitsAllocated) const;
335 
346  Uint8 *target,
347  const Uint8 *source,
348  Uint16 components,
349  Uint32 width,
350  Uint32 height,
351  Uint16 bitsAllocated) const;
352 };
353 
354 
358 {
363  virtual E_TransferSyntax supportedTransferSyntax() const;
364 };
365 
369 {
374  virtual E_TransferSyntax supportedTransferSyntax() const;
375 };
376 
377 #endif
378 
379 /*
380  * CVS/RCS Log:
381  * $Log: djcodece.h,v $
382  * Revision 1.8 2010-10-14 13:17:19 joergr
383  * Updated copyright header. Added reference to COPYRIGHT file.
384  *
385  * Revision 1.7 2010-03-01 10:35:28 uli
386  * Renamed include guards to avoid name clash with e.g. dcmjpeg.
387  *
388  * Revision 1.6 2010-02-26 10:54:41 uli
389  * Fixed a compiler warning with MSVC about unsafe casts.
390  *
391  * Revision 1.5 2010-02-25 10:17:14 uli
392  * Fix doxygen comments in a couple of places.
393  *
394  * Revision 1.4 2009-11-17 16:57:14 joergr
395  * Added new method that allows for determining the color model of the
396  * decompressed image.
397  *
398  * Revision 1.3 2009-10-07 13:16:47 uli
399  * Switched to logging mechanism provided by the "new" oflog module.
400  *
401  * Revision 1.2 2009-07-31 09:14:52 meichel
402  * Added codec parameter and command line options that allow to control
403  * the interleave mode used in the JPEG-LS bitstream when compressing
404  * color images.
405  *
406  * Revision 1.1 2009-07-29 14:46:46 meichel
407  * Initial release of module dcmjpls, a JPEG-LS codec for DCMTK based on CharLS
408  *
409  * Revision 1.3 2008-05-29 10:54:05 meichel
410  * Implemented new method DcmPixelData::getUncompressedFrame
411  * that permits frame-wise access to compressed and uncompressed
412  * objects without ever loading the complete object into main memory.
413  * For this new method to work with compressed images, all classes derived from
414  * DcmCodec need to implement a new method decodeFrame(). For now, only
415  * dummy implementations returning an error code have been defined.
416  *
417  * Revision 1.2 2007/06/20 12:37:37 meichel
418  * Completed implementation of encoder, which now supports lossless
419  * "raw" and "cooked" and near-lossless "cooked" modes.
420  *
421  * Revision 1.1 2007/06/15 14:35:45 meichel
422  * Renamed CMake project and include directory from dcmjpgls to dcmjpls
423  *
424  * Revision 1.4 2007/06/15 10:38:43 meichel
425  * Further code clean-up. Encoder now produces valid offset tables if
426  * a JPEG-LS frame size an odd number of bytes.
427  *
428  * Revision 1.3 2007/06/14 12:36:14 meichel
429  * Further code clean-up. Updated doxygen comments.
430  *
431  * Revision 1.2 2007/06/13 16:41:07 meichel
432  * Code clean-up and removal of dead code
433  *
434  *
435  */
virtual E_TransferSyntax supportedTransferSyntax() const
returns the transfer syntax that this particular codec is able to encode
a class representing a list of DICOM elements in which each element has a different tag and elements ...
Definition: dcitem.h:51
virtual OFCondition determineDecompressedColorModel(const DcmRepresentationParameter *fromParam, DcmPixelSequence *fromPixSeq, const DcmCodecParameter *cp, DcmItem *dataset, OFString &decompressedColorModel) const
determine color model of the decompressed image
DJLSEncoderBase()
default constructor
abstract base class for codec representation parameter sets.
Definition: dcpixel.h:50
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
virtual E_TransferSyntax supportedTransferSyntax() const
returns the transfer syntax that this particular codec is able to encode
OFCondition convertToSampleInterleaved(Uint8 *target, const Uint8 *source, Uint16 components, Uint32 width, Uint32 height, Uint16 bitsAllocated) const
Convert an image from uninterleaved to sample interleaved.
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 elemen...
OFCondition updateLossyCompressionRatio(DcmItem *dataset, double ratio) const
create Lossy Image Compression and Lossy Image Compression Ratio.
representation parameter for JPEG-LS
Definition: djrparam.h:37
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...
this class implements a sequence of pixel items, i.e.
Definition: dcpixseq.h:45
codec class for JPEG-LS lossy and lossless TS encoding
Definition: djcodece.h:368
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 trans...
OFCondition adjustOverlays(DcmItem *dataset, DicomImage &image) const
for all overlay groups create (60xx,3000) Overlay Data.
abstract base class for a codec parameter object that describes the settings (modes of operations) fo...
Definition: dccodec.h:49
this class manages a stack of pointers to DcmObject instances.
Definition: dcstack.h:77
virtual ~DJLSEncoderBase()
destructor
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 dc...
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 ...
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...
codec parameter for JPEG-LS codecs
Definition: djcparam.h:38
Interface class for dcmimgle/dcmimage module.
Definition: dcmimage.h:64
codec class for JPEG-LS lossless only TS encoding
Definition: djcodece.h:357
virtual E_TransferSyntax supportedTransferSyntax() const =0
returns the transfer syntax that this particular codec is able to encode
OFCondition convertToUninterleaved(Uint8 *target, const Uint8 *source, Uint16 components, Uint32 width, Uint32 height, Uint16 bitsAllocated) const
Convert an image from sample interleaved to uninterleaved.
abstract base class for a codec object that can be registered in dcmdata and performs transfer syntax...
Definition: dccodec.h:85
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
a class representing DICOM elements (such as uncompressed pixel data) that can be interpreted either ...
Definition: dcvrpobw.h:41
OFCondition updateDerivationDescription(DcmItem *dataset, const DJLSRepresentationParameter *djrp, double ratio) const
create Derivation Description.
abstract codec class for JPEG-LS encoders.
Definition: djcodece.h:47
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
General purpose class for condition codes.
Definition: ofcond.h:305


Generated on Wed Jan 4 2017 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.6