00001 /* 00002 * 00003 * Copyright (C) 1994-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmdata 00019 * 00020 * Author: Gerd Ehlers, Andreas Barth 00021 * 00022 * Purpose: Interface of class DcmMetaInfo 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:28:21 $ 00026 * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcmtk/dcmdata/dcmetinf.h,v $ 00027 * CVS/RCS Revision: $Revision: 1.22 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 00035 #ifndef DCMETINF_H 00036 #define DCMETINF_H 00037 00038 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00039 00040 #include "dcmtk/ofstd/ofconsol.h" 00041 #include "dcmtk/dcmdata/dctypes.h" 00042 #include "dcmtk/dcmdata/dcitem.h" 00043 00044 00045 #define DCM_Magic "DICM" 00046 #define DCM_MagicLen 4 00047 #define DCM_PreambleLen 128 00048 #define META_HEADER_DEFAULT_TRANSFERSYNTAX EXS_LittleEndianExplicit 00049 00050 00053 class DcmMetaInfo 00054 : public DcmItem 00055 { 00056 00057 public: 00058 00061 DcmMetaInfo(); 00062 00066 DcmMetaInfo(const DcmMetaInfo &old); 00067 00069 DcmMetaInfo& operator=(const DcmMetaInfo&); 00070 00073 virtual ~DcmMetaInfo(); 00074 00078 virtual DcmObject *clone() const 00079 { 00080 return new DcmMetaInfo(*this); 00081 } 00082 00086 virtual DcmEVR ident() const; 00087 00088 E_TransferSyntax getOriginalXfer() const; 00089 00097 virtual void print(ostream &out, 00098 const size_t flags = 0, 00099 const int level = 0, 00100 const char *pixelFileName = NULL, 00101 size_t *pixelCounter = NULL); 00102 00103 virtual void transferInit(); 00104 virtual void transferEnd(); 00105 00106 virtual Uint32 calcElementLength(const E_TransferSyntax xfer, 00107 const E_EncodingType enctype); 00108 00109 virtual OFCondition read(DcmInputStream &inStream, 00110 const E_TransferSyntax xfer = EXS_Unknown, 00111 const E_GrpLenEncoding glenc = EGL_noChange, 00112 const Uint32 maxReadLength = DCM_MaxReadLength); 00113 00120 virtual OFCondition write(DcmOutputStream &outStream, 00121 const E_TransferSyntax oxfer, 00122 const E_EncodingType enctype = EET_UndefinedLength); 00123 00129 virtual OFCondition writeXML(ostream &out, 00130 const size_t flags = 0); 00131 00132 00133 private: 00134 00135 void setPreamble(); 00136 00137 OFBool checkAndReadPreamble(DcmInputStream &inStream, 00138 E_TransferSyntax &newxfer); // out 00139 00140 OFBool nextTagIsMeta(DcmInputStream &inStream); 00141 00142 OFCondition readGroupLength(DcmInputStream &inStream, // inout 00143 const E_TransferSyntax xfer, // in 00144 const DcmTagKey &xtag, // in 00145 const E_GrpLenEncoding glenc, // in 00146 Uint32 &headerLen, // out 00147 Uint32 &bytesRead, // out 00148 const Uint32 maxReadLength = DCM_MaxReadLength); // in 00149 00151 char filePreamble[DCM_PreambleLen + DCM_MagicLen]; 00152 00153 OFBool preambleUsed; 00154 E_TransferState fPreambleTransferState; 00155 E_TransferSyntax Xfer; 00156 00157 }; 00158 00159 #endif // DCMETINF_H 00160 00161 /* 00162 ** CVS/RCS Log: 00163 ** $Log: dcmetinf.h,v $ 00164 ** Revision 1.22 2005/12/08 16:28:21 meichel 00165 ** Changed include path schema for all DCMTK header files 00166 ** 00167 ** Revision 1.21 2005/11/07 16:59:24 meichel 00168 ** Cleaned up some copy constructors in the DcmObject hierarchy. 00169 ** 00170 ** Revision 1.20 2004/07/01 12:28:25 meichel 00171 ** Introduced virtual clone method for DcmObject and derived classes. 00172 ** 00173 ** Revision 1.19 2003/03/21 13:06:46 meichel 00174 ** Minor code purifications for warnings reported by MSVC in Level 4 00175 ** 00176 ** Revision 1.18 2002/12/06 12:49:11 joergr 00177 ** Enhanced "print()" function by re-working the implementation and replacing 00178 ** the boolean "showFullData" parameter by a more general integer flag. 00179 ** Added doc++ documentation. 00180 ** Made source code formatting more consistent with other modules/files. 00181 ** 00182 ** Revision 1.17 2002/08/27 16:55:35 meichel 00183 ** Initial release of new DICOM I/O stream classes that add support for stream 00184 ** compression (deflated little endian explicit VR transfer syntax) 00185 ** 00186 ** Revision 1.16 2002/04/25 09:40:56 joergr 00187 ** Added support for XML output of DICOM objects. 00188 ** 00189 ** Revision 1.15 2001/09/25 17:19:27 meichel 00190 ** Adapted dcmdata to class OFCondition 00191 ** 00192 ** Revision 1.14 2001/06/01 15:48:41 meichel 00193 ** Updated copyright header 00194 ** 00195 ** Revision 1.13 2000/04/14 15:31:32 meichel 00196 ** Removed default value from output stream passed to print() method. 00197 ** Required for use in multi-thread environments. 00198 ** 00199 ** Revision 1.12 2000/03/08 16:26:16 meichel 00200 ** Updated copyright header. 00201 ** 00202 ** Revision 1.11 2000/03/03 14:05:24 meichel 00203 ** Implemented library support for redirecting error messages into memory 00204 ** instead of printing them to stdout/stderr for GUI applications. 00205 ** 00206 ** Revision 1.10 2000/02/10 10:50:51 joergr 00207 ** Added new feature to dcmdump (enhanced print method of dcmdata): write 00208 ** pixel data/item value fields to raw files. 00209 ** 00210 ** Revision 1.9 1999/03/31 09:24:41 meichel 00211 ** Updated copyright header in module dcmdata 00212 ** 00213 ** Revision 1.8 1997/09/22 14:56:12 hewett 00214 ** Added a method to retreive the original transfer syntax of a read 00215 ** meta-header (getOriginalXfer). This functionality is needed by 00216 ** the DCMCHECK package. 00217 ** 00218 ** Revision 1.7 1997/07/21 08:25:09 andreas 00219 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL) 00220 ** with one unique boolean type OFBool. 00221 ** 00222 ** Revision 1.6 1997/05/16 08:23:47 andreas 00223 ** - Revised handling of GroupLength elements and support of 00224 ** DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding 00225 ** got additional enumeration values (for a description see dctypes.h). 00226 ** addGroupLength and removeGroupLength methods are replaced by 00227 ** computeGroupLengthAndPadding. To support Padding, the parameters of 00228 ** element and sequence write functions changed. 00229 ** - Added a new method calcElementLength to calculate the length of an 00230 ** element, item or sequence. For elements it returns the length of 00231 ** tag, length field, vr field, and value length, for item and 00232 ** sequences it returns the length of the whole item. sequence including 00233 ** the Delimitation tag (if appropriate). It can never return 00234 ** UndefinedLength. 00235 ** 00236 ** Revision 1.5 1996/08/05 08:45:24 andreas 00237 ** new print routine with additional parameters: 00238 ** - print into files 00239 ** - fix output length for elements 00240 ** corrected error in search routine with parameter ESM_fromStackTop 00241 ** 00242 ** Revision 1.4 1996/01/09 11:06:16 andreas 00243 ** New Support for Visual C++ 00244 ** Correct problems with inconsistent const declarations 00245 ** 00246 ** Revision 1.3 1996/01/05 13:22:57 andreas 00247 ** - changed to support new streaming facilities 00248 ** - more cleanups 00249 ** - merged read / write methods for block and file transfer 00250 ** 00251 */ 00252