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 the class DcmDataset 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:28:02 $ 00026 * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcmtk/dcmdata/dcdatset.h,v $ 00027 * CVS/RCS Revision: $Revision: 1.25 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 00035 #ifndef DCDATSET_H 00036 #define DCDATSET_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/dcerror.h" 00042 #include "dcmtk/dcmdata/dctypes.h" 00043 #include "dcmtk/dcmdata/dcitem.h" 00044 00045 00046 // forward declarations 00047 class DcmInputStream; 00048 class DcmOutputStream; 00049 class DcmRepresentationParameter; 00050 00051 00054 class DcmDataset 00055 : public DcmItem 00056 { 00057 00058 public: 00059 00062 DcmDataset(); 00063 00067 DcmDataset(const DcmDataset &old); 00068 00071 virtual ~DcmDataset(); 00072 00076 virtual DcmObject *clone() const 00077 { 00078 return new DcmDataset(*this); 00079 } 00080 00084 virtual DcmEVR ident() const; 00085 00086 E_TransferSyntax getOriginalXfer() const; 00087 00095 virtual void print(ostream &out, 00096 const size_t flags = 0, 00097 const int level = 0, 00098 const char *pixelFileName = NULL, 00099 size_t *pixelCounter = NULL); 00100 00101 Uint32 calcElementLength(const E_TransferSyntax xfer, 00102 const E_EncodingType enctype); 00103 00104 virtual OFBool canWriteXfer(const E_TransferSyntax newXfer, 00105 const E_TransferSyntax oldXfer = EXS_Unknown); 00106 00122 virtual OFCondition read(DcmInputStream &inStream, 00123 const E_TransferSyntax xfer = EXS_Unknown, 00124 const E_GrpLenEncoding glenc = EGL_noChange, 00125 const Uint32 maxReadLength = DCM_MaxReadLength); 00126 00133 virtual OFCondition write(DcmOutputStream &outStream, 00134 const E_TransferSyntax oxfer, 00135 const E_EncodingType enctype = EET_UndefinedLength); 00136 00164 virtual OFCondition write(DcmOutputStream &outStream, 00165 const E_TransferSyntax oxfer, 00166 const E_EncodingType enctype, 00167 const E_GrpLenEncoding glenc, 00168 const E_PaddingEncoding padenc = EPD_noChange, 00169 const Uint32 padlen = 0, 00170 const Uint32 subPadlen = 0, 00171 Uint32 instanceLength = 0); 00172 00179 virtual OFCondition writeSignatureFormat(DcmOutputStream &outStream, 00180 const E_TransferSyntax oxfer, 00181 const E_EncodingType enctype = EET_UndefinedLength); 00182 00189 virtual OFCondition writeXML(ostream &out, 00190 const size_t flags = 0); 00191 00192 virtual OFCondition clear(); 00193 00205 virtual OFCondition loadFile(const char *fileName, 00206 const E_TransferSyntax readXfer = EXS_Unknown, 00207 const E_GrpLenEncoding groupLength = EGL_noChange, 00208 const Uint32 maxReadLength = DCM_MaxReadLength); 00209 00222 virtual OFCondition saveFile(const char *fileName, 00223 const E_TransferSyntax writeXfer = EXS_Unknown, 00224 const E_EncodingType encodingType = EET_UndefinedLength, 00225 const E_GrpLenEncoding groupLength = EGL_recalcGL, 00226 const E_PaddingEncoding padEncoding = EPD_noChange, 00227 const Uint32 padLength = 0, 00228 const Uint32 subPadLength = 0); 00229 00230 // methods for different pixel representations 00231 00232 // choose Representation changes the representation of 00233 // PixelData Elements in the data set to the given representation 00234 // If the representation does not exists it creates one. 00235 OFCondition chooseRepresentation(const E_TransferSyntax repType, 00236 const DcmRepresentationParameter *repParam); 00237 00238 // checks if all PixelData elements have a conforming representation 00239 // (for definition of conforming representation see dcpixel.h). 00240 // if one PixelData element has no conforming representation 00241 // OFFalse is returned. 00242 OFBool hasRepresentation(const E_TransferSyntax repType, 00243 const DcmRepresentationParameter *repParam); 00244 00247 void removeAllButOriginalRepresentations(); 00248 00252 void removeAllButCurrentRepresentations(); 00253 00254 00255 private: 00256 00258 DcmDataset& operator=(const DcmDataset&); 00259 00261 E_TransferSyntax Xfer; 00262 }; 00263 00264 00265 #endif // DCDATSET_H 00266 00267 00268 /* 00269 ** CVS/RCS Log: 00270 ** $Log: dcdatset.h,v $ 00271 ** Revision 1.25 2005/12/08 16:28:02 meichel 00272 ** Changed include path schema for all DCMTK header files 00273 ** 00274 ** Revision 1.24 2005/11/11 10:31:57 meichel 00275 ** Added explicit DcmDataset::clear() implementation. 00276 ** 00277 ** Revision 1.23 2004/07/01 12:28:25 meichel 00278 ** Introduced virtual clone method for DcmObject and derived classes. 00279 ** 00280 ** Revision 1.22 2003/03/21 13:06:46 meichel 00281 ** Minor code purifications for warnings reported by MSVC in Level 4 00282 ** 00283 ** Revision 1.21 2002/12/09 09:31:13 wilkens 00284 ** Modified/Added doc++ documentation. 00285 ** 00286 ** Revision 1.20 2002/12/06 12:49:08 joergr 00287 ** Enhanced "print()" function by re-working the implementation and replacing 00288 ** the boolean "showFullData" parameter by a more general integer flag. 00289 ** Added doc++ documentation. 00290 ** Made source code formatting more consistent with other modules/files. 00291 ** 00292 ** Revision 1.19 2002/08/27 16:55:30 meichel 00293 ** Initial release of new DICOM I/O stream classes that add support for stream 00294 ** compression (deflated little endian explicit VR transfer syntax) 00295 ** 00296 ** Revision 1.18 2002/04/25 09:40:13 joergr 00297 ** Added support for XML output of DICOM objects. 00298 ** 00299 ** Revision 1.17 2002/04/11 12:22:52 joergr 00300 ** Added new methods for loading and saving DICOM files. 00301 ** 00302 ** Revision 1.16 2001/09/25 17:19:24 meichel 00303 ** Adapted dcmdata to class OFCondition 00304 ** 00305 ** Revision 1.15 2001/06/01 15:48:34 meichel 00306 ** Updated copyright header 00307 ** 00308 ** Revision 1.14 2000/11/07 16:56:05 meichel 00309 ** Initial release of dcmsign module for DICOM Digital Signatures 00310 ** 00311 ** Revision 1.13 2000/04/14 15:31:31 meichel 00312 ** Removed default value from output stream passed to print() method. 00313 ** Required for use in multi-thread environments. 00314 ** 00315 ** Revision 1.12 2000/03/08 16:26:12 meichel 00316 ** Updated copyright header. 00317 ** 00318 ** Revision 1.11 2000/03/03 14:05:22 meichel 00319 ** Implemented library support for redirecting error messages into memory 00320 ** instead of printing them to stdout/stderr for GUI applications. 00321 ** 00322 ** Revision 1.10 2000/02/10 10:50:50 joergr 00323 ** Added new feature to dcmdump (enhanced print method of dcmdata): write 00324 ** pixel data/item value fields to raw files. 00325 ** 00326 ** Revision 1.9 1999/03/31 09:24:32 meichel 00327 ** Updated copyright header in module dcmdata 00328 ** 00329 ** Revision 1.8 1997/07/21 08:14:38 andreas 00330 ** - New environment for encapsulated pixel representations. DcmPixelData 00331 ** can contain different representations and uses codecs to convert 00332 ** between them. Codecs are derived from the DcmCodec class. New error 00333 ** codes are introduced for handling of representations. New internal 00334 ** value representation (only for ident()) for PixelData 00335 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL) 00336 ** with one unique boolean type OFBool. 00337 ** 00338 ** Revision 1.7 1997/05/27 13:48:26 andreas 00339 ** - Add method canWriteXfer to class DcmObject and all derived classes. 00340 ** This method checks whether it is possible to convert the original 00341 ** transfer syntax to an new transfer syntax. The check is used in the 00342 ** dcmconv utility to prohibit the change of a compressed transfer 00343 ** syntax to a uncompressed. 00344 ** 00345 ** Revision 1.6 1997/05/16 08:23:45 andreas 00346 ** - Revised handling of GroupLength elements and support of 00347 ** DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding 00348 ** got additional enumeration values (for a description see dctypes.h). 00349 ** addGroupLength and removeGroupLength methods are replaced by 00350 ** computeGroupLengthAndPadding. To support Padding, the parameters of 00351 ** element and sequence write functions changed. 00352 ** - Added a new method calcElementLength to calculate the length of an 00353 ** element, item or sequence. For elements it returns the length of 00354 ** tag, length field, vr field, and value length, for item and 00355 ** sequences it returns the length of the whole item. sequence including 00356 ** the Delimitation tag (if appropriate). It can never return 00357 ** UndefinedLength. 00358 ** 00359 ** Revision 1.5 1996/08/05 08:45:17 andreas 00360 ** new print routine with additional parameters: 00361 ** - print into files 00362 ** - fix output length for elements 00363 ** corrected error in search routine with parameter ESM_fromStackTop 00364 ** 00365 ** Revision 1.4 1996/01/09 11:06:14 andreas 00366 ** New Support for Visual C++ 00367 ** Correct problems with inconsistent const declarations 00368 ** 00369 ** Revision 1.3 1996/01/05 13:22:52 andreas 00370 ** - changed to support new streaming facilities 00371 ** - more cleanups 00372 ** - merged read / write methods for block and file transfer 00373 ** 00374 */