OFFIS DCMTK  Version 3.6.0
djcodecd.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 decoders.
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:17:16 $
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 DJCODECD_H
30 #define DJCODECD_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/ofstring.h" /* for class OFString */
37 
38 
39 class DataInterface;
40 class DJEncoder;
41 class DcmDataset;
42 class DcmItem;
43 class DJCodecParameter;
44 class DJDecoder;
45 
53 class DJCodecDecoder : public DcmCodec
54 {
55 public:
56 
59 
61  virtual ~DJCodecDecoder();
62 
73  virtual OFCondition decode(
74  const DcmRepresentationParameter * fromRepParam,
75  DcmPixelSequence * pixSeq,
76  DcmPolymorphOBOW& uncompressedPixelData,
77  const DcmCodecParameter * cp,
78  const DcmStack& objStack) const;
79 
105  virtual OFCondition decodeFrame(
106  const DcmRepresentationParameter * fromParam,
107  DcmPixelSequence * fromPixSeq,
108  const DcmCodecParameter * cp,
109  DcmItem *dataset,
110  Uint32 frameNo,
111  Uint32& startFragment,
112  void *buffer,
113  Uint32 bufSize,
114  OFString& decompressedColorModel) const;
115 
130  virtual OFCondition encode(
131  const Uint16 * pixelData,
132  const Uint32 length,
133  const DcmRepresentationParameter * toRepParam,
134  DcmPixelSequence * & pixSeq,
135  const DcmCodecParameter *cp,
136  DcmStack & objStack) const;
137 
152  virtual OFCondition encode(
153  const E_TransferSyntax fromRepType,
154  const DcmRepresentationParameter * fromRepParam,
155  DcmPixelSequence * fromPixSeq,
156  const DcmRepresentationParameter * toRepParam,
157  DcmPixelSequence * & toPixSeq,
158  const DcmCodecParameter * cp,
159  DcmStack & objStack) const;
160 
168  virtual OFBool canChangeCoding(
169  const E_TransferSyntax oldRepType,
170  const E_TransferSyntax newRepType) const;
171 
186  const DcmRepresentationParameter *fromParam,
187  DcmPixelSequence *fromPixSeq,
188  const DcmCodecParameter *cp,
189  DcmItem *dataset,
190  OFString &decompressedColorModel) const;
191 
196  virtual E_TransferSyntax supportedTransferSyntax() const = 0;
197 
198 private:
199 
208  const DcmRepresentationParameter * toRepParam,
209  const DJCodecParameter *cp,
210  Uint8 bitsPerSample,
211  OFBool isYBR) const = 0;
212 
213  // static private helper methods
214 
222  static Uint8 scanJpegDataForBitDepth(
223  const Uint8 *data,
224  const Uint32 fragmentLength);
225 
232  static Uint16 readUint16(const Uint8 *data);
233 
243  Uint8 *imageFrame,
244  Uint16 columns,
245  Uint16 rows);
246 
256  Uint16 *imageFrame,
257  Uint16 columns,
258  Uint16 rows);
259 
268  static OFBool requiresPlanarConfiguration(
269  const char *sopClassUID,
270  EP_Interpretation photometricInterpretation);
271 };
272 
273 #endif
274 
275 /*
276  * CVS/RCS Log
277  * $Log: djcodecd.h,v $
278  * Revision 1.8 2010-10-14 13:17:16 joergr
279  * Updated copyright header. Added reference to COPYRIGHT file.
280  *
281  * Revision 1.7 2009-11-17 16:46:01 joergr
282  * Added new method that allows for determining the color model of the
283  * decompressed image.
284  *
285  * Revision 1.6 2008-05-29 10:48:44 meichel
286  * Implemented new method DcmPixelData::getUncompressedFrame
287  * that permits frame-wise access to compressed and uncompressed
288  * objects without ever loading the complete object into main memory.
289  * For this new method to work with compressed images, all classes derived from
290  * DcmCodec need to implement a new method decodeFrame(). For now, only
291  * dummy implementations returning an error code have been defined.
292  *
293  * Revision 1.5 2005/12/08 16:59:11 meichel
294  * Changed include path schema for all DCMTK header files
295  *
296  * Revision 1.4 2004/08/24 14:57:08 meichel
297  * Updated compression helper methods. Image type is not set to SECONDARY
298  * any more, support for the purpose of reference code sequence added.
299  *
300  * Revision 1.3 2003/07/04 13:26:22 meichel
301  * Replaced forward declarations for OFString with explicit includes,
302  * needed when compiling with HAVE_STD_STRING
303  *
304  * Revision 1.2 2002/05/24 14:58:03 meichel
305  * Moved helper methods that are useful for different compression techniques
306  * from module dcmjpeg to module dcmdata
307  *
308  * Revision 1.1 2001/11/13 15:56:16 meichel
309  * Initial release of module dcmjpeg
310  *
311  *
312  */
a class representing a list of DICOM elements in which each element has a different tag and elements ...
Definition: dcitem.h:51
abstract base class for compression classes.
Definition: djencabs.h:39
static Uint8 scanJpegDataForBitDepth(const Uint8 *data, const Uint32 fragmentLength)
scans the given block of JPEG data for a Start of Frame marker and returns the number of bits per pix...
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...
abstract codec class for JPEG decoders.
Definition: djcodecd.h:53
abstract base class for codec representation parameter sets.
Definition: dcpixel.h:50
static OFBool requiresPlanarConfiguration(const char *sopClassUID, EP_Interpretation photometricInterpretation)
examines if a given image requires color-by-plane planar configuration depending on SOP Class UID (DI...
this class implements a sequence of pixel items, i.e.
Definition: dcpixseq.h:45
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...
static OFCondition createPlanarConfigurationWord(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 configu...
static OFCondition createPlanarConfigurationByte(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 configur...
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...
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 ~DJCodecDecoder()
destructor
static Uint16 readUint16(const Uint8 *data)
reads two bytes from the given array of little endian 16-bit values and returns the value as Uint16 i...
virtual DJDecoder * createDecoderInstance(const DcmRepresentationParameter *toRepParam, const DJCodecParameter *cp, Uint8 bitsPerSample, OFBool isYBR) const =0
creates an instance of the compression library to be used for decoding.
virtual E_TransferSyntax supportedTransferSyntax() const =0
returns the transfer syntax that this particular codec is able to decode.
a class handling the DICOM dataset format (files without meta header)
Definition: dcdatset.h:46
DJCodecDecoder()
default constructor
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
codec parameter for IJG codecs
Definition: djcparam.h:38
abstract base class for decompression classes.
Definition: djdecabs.h:42
virtual OFCondition determineDecompressedColorModel(const DcmRepresentationParameter *fromParam, DcmPixelSequence *fromPixSeq, const DcmCodecParameter *cp, DcmItem *dataset, OFString &decompressedColorModel) const
determine color model of the decompressed image
General purpose class for condition codes.
Definition: ofcond.h:305
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...


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