00001 /* 00002 * 00003 * Copyright (C) 2001-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmjpeg 00015 * 00016 * Author: Marco Eichelberg, Norbert Olges 00017 * 00018 * Purpose: abstract codec class for JPEG decoders. 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:17:16 $ 00022 * CVS/RCS Revision: $Revision: 1.8 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 #ifndef DJCODECD_H 00030 #define DJCODECD_H 00031 00032 #include "dcmtk/config/osconfig.h" 00033 #include "dcmtk/ofstd/oftypes.h" 00034 #include "dcmtk/dcmdata/dccodec.h" /* for class DcmCodec */ 00035 #include "dcmtk/dcmjpeg/djutils.h" /* for enums */ 00036 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */ 00037 00038 00039 class DataInterface; 00040 class DJEncoder; 00041 class DcmDataset; 00042 class DcmItem; 00043 class DJCodecParameter; 00044 class DJDecoder; 00045 00053 class DJCodecDecoder : public DcmCodec 00054 { 00055 public: 00056 00058 DJCodecDecoder(); 00059 00061 virtual ~DJCodecDecoder(); 00062 00073 virtual OFCondition decode( 00074 const DcmRepresentationParameter * fromRepParam, 00075 DcmPixelSequence * pixSeq, 00076 DcmPolymorphOBOW& uncompressedPixelData, 00077 const DcmCodecParameter * cp, 00078 const DcmStack& objStack) const; 00079 00105 virtual OFCondition decodeFrame( 00106 const DcmRepresentationParameter * fromParam, 00107 DcmPixelSequence * fromPixSeq, 00108 const DcmCodecParameter * cp, 00109 DcmItem *dataset, 00110 Uint32 frameNo, 00111 Uint32& startFragment, 00112 void *buffer, 00113 Uint32 bufSize, 00114 OFString& decompressedColorModel) const; 00115 00130 virtual OFCondition encode( 00131 const Uint16 * pixelData, 00132 const Uint32 length, 00133 const DcmRepresentationParameter * toRepParam, 00134 DcmPixelSequence * & pixSeq, 00135 const DcmCodecParameter *cp, 00136 DcmStack & objStack) const; 00137 00152 virtual OFCondition encode( 00153 const E_TransferSyntax fromRepType, 00154 const DcmRepresentationParameter * fromRepParam, 00155 DcmPixelSequence * fromPixSeq, 00156 const DcmRepresentationParameter * toRepParam, 00157 DcmPixelSequence * & toPixSeq, 00158 const DcmCodecParameter * cp, 00159 DcmStack & objStack) const; 00160 00168 virtual OFBool canChangeCoding( 00169 const E_TransferSyntax oldRepType, 00170 const E_TransferSyntax newRepType) const; 00171 00185 virtual OFCondition determineDecompressedColorModel( 00186 const DcmRepresentationParameter *fromParam, 00187 DcmPixelSequence *fromPixSeq, 00188 const DcmCodecParameter *cp, 00189 DcmItem *dataset, 00190 OFString &decompressedColorModel) const; 00191 00196 virtual E_TransferSyntax supportedTransferSyntax() const = 0; 00197 00198 private: 00199 00207 virtual DJDecoder *createDecoderInstance( 00208 const DcmRepresentationParameter * toRepParam, 00209 const DJCodecParameter *cp, 00210 Uint8 bitsPerSample, 00211 OFBool isYBR) const = 0; 00212 00213 // static private helper methods 00214 00222 static Uint8 scanJpegDataForBitDepth( 00223 const Uint8 *data, 00224 const Uint32 fragmentLength); 00225 00232 static Uint16 readUint16(const Uint8 *data); 00233 00242 static OFCondition createPlanarConfigurationByte( 00243 Uint8 *imageFrame, 00244 Uint16 columns, 00245 Uint16 rows); 00246 00255 static OFCondition createPlanarConfigurationWord( 00256 Uint16 *imageFrame, 00257 Uint16 columns, 00258 Uint16 rows); 00259 00268 static OFBool requiresPlanarConfiguration( 00269 const char *sopClassUID, 00270 EP_Interpretation photometricInterpretation); 00271 }; 00272 00273 #endif 00274 00275 /* 00276 * CVS/RCS Log 00277 * $Log: djcodecd.h,v $ 00278 * Revision 1.8 2010-10-14 13:17:16 joergr 00279 * Updated copyright header. Added reference to COPYRIGHT file. 00280 * 00281 * Revision 1.7 2009-11-17 16:46:01 joergr 00282 * Added new method that allows for determining the color model of the 00283 * decompressed image. 00284 * 00285 * Revision 1.6 2008-05-29 10:48:44 meichel 00286 * Implemented new method DcmPixelData::getUncompressedFrame 00287 * that permits frame-wise access to compressed and uncompressed 00288 * objects without ever loading the complete object into main memory. 00289 * For this new method to work with compressed images, all classes derived from 00290 * DcmCodec need to implement a new method decodeFrame(). For now, only 00291 * dummy implementations returning an error code have been defined. 00292 * 00293 * Revision 1.5 2005/12/08 16:59:11 meichel 00294 * Changed include path schema for all DCMTK header files 00295 * 00296 * Revision 1.4 2004/08/24 14:57:08 meichel 00297 * Updated compression helper methods. Image type is not set to SECONDARY 00298 * any more, support for the purpose of reference code sequence added. 00299 * 00300 * Revision 1.3 2003/07/04 13:26:22 meichel 00301 * Replaced forward declarations for OFString with explicit includes, 00302 * needed when compiling with HAVE_STD_STRING 00303 * 00304 * Revision 1.2 2002/05/24 14:58:03 meichel 00305 * Moved helper methods that are useful for different compression techniques 00306 * from module dcmjpeg to module dcmdata 00307 * 00308 * Revision 1.1 2001/11/13 15:56:16 meichel 00309 * Initial release of module dcmjpeg 00310 * 00311 * 00312 */