OFFIS DCMTK  Version 3.6.0
djcodece.h
1 /*
2  *
3  * Copyright (C) 2001-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: dcmjpeg
15  *
16  * Author: Marco Eichelberg, Norbert Olges
17  *
18  * Purpose: abstract codec class for JPEG encoders.
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:17:17 $
22  * CVS/RCS Revision: $Revision: 1.10 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DJCODEC_H
30 #define DJCODEC_H
31 
32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/ofstd/oftypes.h"
34 #include "dcmtk/dcmdata/dccodec.h" /* for class DcmCodec */
35 #include "dcmtk/dcmjpeg/djutils.h" /* for enums */
36 #include "dcmtk/ofstd/oflist.h"
37 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */
38 
39 class DataInterface;
40 class DJEncoder;
41 class DcmDataset;
42 class DJCodecParameter;
43 class DJDecoder;
44 class DcmItem;
45 class DcmPixelItem;
46 class DicomImage;
47 class DcmTagKey;
48 
49 
57 class DJCodecEncoder : public DcmCodec
58 {
59 public:
60 
63 
65  virtual ~DJCodecEncoder();
66 
77  virtual OFCondition decode(
78  const DcmRepresentationParameter * fromRepParam,
79  DcmPixelSequence * pixSeq,
80  DcmPolymorphOBOW& uncompressedPixelData,
81  const DcmCodecParameter * cp,
82  const DcmStack& objStack) const;
83 
109  virtual OFCondition decodeFrame(
110  const DcmRepresentationParameter * fromParam,
111  DcmPixelSequence * fromPixSeq,
112  const DcmCodecParameter * cp,
113  DcmItem *dataset,
114  Uint32 frameNo,
115  Uint32& startFragment,
116  void *buffer,
117  Uint32 bufSize,
118  OFString& decompressedColorModel) const;
119 
134  virtual OFCondition encode(
135  const Uint16 * pixelData,
136  const Uint32 length,
137  const DcmRepresentationParameter * toRepParam,
138  DcmPixelSequence * & pixSeq,
139  const DcmCodecParameter *cp,
140  DcmStack & objStack) const;
141 
156  virtual OFCondition encode(
157  const E_TransferSyntax fromRepType,
158  const DcmRepresentationParameter * fromRepParam,
159  DcmPixelSequence * fromPixSeq,
160  const DcmRepresentationParameter * toRepParam,
161  DcmPixelSequence * & toPixSeq,
162  const DcmCodecParameter * cp,
163  DcmStack & objStack) const;
164 
172  virtual OFBool canChangeCoding(
173  const E_TransferSyntax oldRepType,
174  const E_TransferSyntax newRepType) const;
175 
190  const DcmRepresentationParameter *fromParam,
191  DcmPixelSequence *fromPixSeq,
192  const DcmCodecParameter *cp,
193  DcmItem *dataset,
194  OFString &decompressedColorModel) const;
195 
200  virtual E_TransferSyntax supportedTransferSyntax() const = 0;
201 
202 protected:
203 
208  static void appendCompressionRatio(OFString& arg, double ratio);
209 
222  Uint8 *pixelData,
223  const unsigned long numValues,
224  const Uint16 samplesPerPixel,
225  const Uint16 oldPlanarConfig);
226 
239  Uint16 *pixelData,
240  const unsigned long numValues,
241  const Uint16 samplesPerPixel,
242  const Uint16 oldPlanarConfig);
243 
244 private:
245 
263  OFBool YBRmode,
264  DcmItem *dataset,
265  const DcmRepresentationParameter * toRepParam,
266  DcmPixelSequence * & pixSeq,
267  const DJCodecParameter *cp,
268  double& compressionRatio) const;
269 
284  DcmItem *dataset,
285  const DcmRepresentationParameter * toRepParam,
286  DcmPixelSequence * & pixSeq,
287  const DJCodecParameter *cp,
288  double& compressionRatio) const;
289 
303  const DcmRepresentationParameter * toRepParam,
304  DcmPixelSequence * & pixSeq,
305  const DcmCodecParameter *cp,
306  DcmStack & objStack) const;
307 
315  virtual OFCondition updateLossyCompressionRatio(DcmItem *dataset, double ratio) const;
316 
328  DcmItem *dataset,
329  const DcmRepresentationParameter * toRepParam,
330  const DJCodecParameter *cp,
331  Uint8 bitsPerSample,
332  double ratio) const;
333 
339  virtual OFCondition adjustOverlays(DcmItem *dataset, DicomImage& image) const;
340 
345  virtual OFBool isLosslessProcess() const = 0;
346 
357  virtual void createDerivationDescription(
358  const DcmRepresentationParameter * toRepParam,
359  const DJCodecParameter *cp,
360  Uint8 bitsPerSample,
361  double ratio,
362  OFString& derivationDescription) const = 0;
363 
372  const DcmRepresentationParameter * toRepParam,
373  const DJCodecParameter *cp,
374  Uint8 bitsPerSample) const = 0;
375 
384  static OFCondition correctVOIWindows(DcmItem *dataset, double voiOffset, double voiFactor);
385 
386  OFCondition updatePlanarConfiguration(
387  DcmItem *item,
388  const Uint16 newPlanConf) const;
389 };
390 
391 #endif
392 
393 /*
394  * CVS/RCS Log
395  * $Log: djcodece.h,v $
396  * Revision 1.10 2010-10-14 13:17:17 joergr
397  * Updated copyright header. Added reference to COPYRIGHT file.
398  *
399  * Revision 1.9 2009-11-17 16:46:01 joergr
400  * Added new method that allows for determining the color model of the
401  * decompressed image.
402  *
403  * Revision 1.8 2008-05-29 10:48:44 meichel
404  * Implemented new method DcmPixelData::getUncompressedFrame
405  * that permits frame-wise access to compressed and uncompressed
406  * objects without ever loading the complete object into main memory.
407  * For this new method to work with compressed images, all classes derived from
408  * DcmCodec need to implement a new method decodeFrame(). For now, only
409  * dummy implementations returning an error code have been defined.
410  *
411  * Revision 1.7 2005/12/08 16:59:12 meichel
412  * Changed include path schema for all DCMTK header files
413  *
414  * Revision 1.6 2005/12/01 11:13:01 onken
415  * Minor code modifications for gcc 4
416  *
417  * Revision 1.5 2005/11/29 11:00:40 onken
418  * *** empty log message ***
419  *
420  * Revision 1.4 2005/11/29 08:50:34 onken
421  * Added support for "true" lossless compression in dcmjpeg, that doesn't
422  * use dcmimage classes, but compresses raw pixel data (8 and 16 bit) to
423  * avoid losses in quality caused by color space conversions or modality
424  * transformations etc.
425  * Corresponding commandline option in dcmcjpeg (new default)
426  *
427  * Revision 1.3 2003/07/04 13:26:22 meichel
428  * Replaced forward declarations for OFString with explicit includes,
429  * needed when compiling with HAVE_STD_STRING
430  *
431  * Revision 1.2 2002/05/24 14:58:04 meichel
432  * Moved helper methods that are useful for different compression techniques
433  * from module dcmjpeg to module dcmdata
434  *
435  * Revision 1.1 2001/11/13 15:56:16 meichel
436  * Initial release of module dcmjpeg
437  *
438  *
439  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2