00001 /* 00002 * 00003 * Copyright (C) 1994-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: dcmdata 00015 * 00016 * Author: Gerd Ehlers, Andreas Barth 00017 * 00018 * Purpose: Interface of the class DcmDataset 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:15:40 $ 00022 * CVS/RCS Revision: $Revision: 1.36 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DCDATSET_H 00031 #define DCDATSET_H 00032 00033 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00034 00035 #include "dcmtk/dcmdata/dcitem.h" 00036 00037 00038 // forward declarations 00039 class DcmInputStream; 00040 class DcmOutputStream; 00041 class DcmRepresentationParameter; 00042 00043 00046 class DcmDataset 00047 : public DcmItem 00048 { 00049 00050 public: 00051 00054 DcmDataset(); 00055 00059 DcmDataset(const DcmDataset &old); 00060 00063 virtual ~DcmDataset(); 00064 00068 DcmDataset& operator=(const DcmDataset& obj); 00069 00073 virtual DcmObject *clone() const 00074 { 00075 return new DcmDataset(*this); 00076 } 00077 00090 virtual OFCondition copyFrom(const DcmObject& rhs); 00091 00095 virtual DcmEVR ident() const; 00096 00100 virtual OFCondition clear(); 00101 00105 virtual void removeInvalidGroups(); 00106 00110 E_TransferSyntax getOriginalXfer() const; 00111 00119 virtual void print(STD_NAMESPACE ostream&out, 00120 const size_t flags = 0, 00121 const int level = 0, 00122 const char *pixelFileName = NULL, 00123 size_t *pixelCounter = NULL); 00124 00135 Uint32 calcElementLength(const E_TransferSyntax xfer, 00136 const E_EncodingType enctype); 00137 00143 virtual OFBool canWriteXfer(const E_TransferSyntax newXfer, 00144 const E_TransferSyntax oldXfer = EXS_Unknown); 00145 00161 virtual OFCondition read(DcmInputStream &inStream, 00162 const E_TransferSyntax xfer = EXS_Unknown, 00163 const E_GrpLenEncoding glenc = EGL_noChange, 00164 const Uint32 maxReadLength = DCM_MaxReadLength); 00165 00173 virtual OFCondition write(DcmOutputStream &outStream, 00174 const E_TransferSyntax oxfer, 00175 const E_EncodingType enctype, 00176 DcmWriteCache *wcache); 00177 00206 virtual OFCondition write(DcmOutputStream &outStream, 00207 const E_TransferSyntax oxfer, 00208 const E_EncodingType enctype, 00209 DcmWriteCache *wcache, 00210 const E_GrpLenEncoding glenc, 00211 const E_PaddingEncoding padenc = EPD_noChange, 00212 const Uint32 padlen = 0, 00213 const Uint32 subPadlen = 0, 00214 Uint32 instanceLength = 0); 00215 00223 virtual OFCondition writeSignatureFormat( 00224 DcmOutputStream &outStream, 00225 const E_TransferSyntax oxfer, 00226 const E_EncodingType enctype, 00227 DcmWriteCache *wcache); 00228 00235 virtual OFCondition writeXML(STD_NAMESPACE ostream&out, 00236 const size_t flags = 0); 00237 00249 virtual OFCondition loadFile(const char *fileName, 00250 const E_TransferSyntax readXfer = EXS_Unknown, 00251 const E_GrpLenEncoding groupLength = EGL_noChange, 00252 const Uint32 maxReadLength = DCM_MaxReadLength); 00253 00266 virtual OFCondition saveFile(const char *fileName, 00267 const E_TransferSyntax writeXfer = EXS_Unknown, 00268 const E_EncodingType encodingType = EET_UndefinedLength, 00269 const E_GrpLenEncoding groupLength = EGL_recalcGL, 00270 const E_PaddingEncoding padEncoding = EPD_noChange, 00271 const Uint32 padLength = 0, 00272 const Uint32 subPadLength = 0); 00273 00274 // methods for different pixel representations 00275 00283 OFCondition chooseRepresentation(const E_TransferSyntax repType, 00284 const DcmRepresentationParameter *repParam); 00285 00293 OFBool hasRepresentation(const E_TransferSyntax repType, 00294 const DcmRepresentationParameter *repParam); 00295 00298 void removeAllButOriginalRepresentations(); 00299 00303 void removeAllButCurrentRepresentations(); 00304 00305 00306 private: 00307 00309 E_TransferSyntax Xfer; 00310 }; 00311 00312 00313 #endif // DCDATSET_H 00314 00315 00316 /* 00317 ** CVS/RCS Log: 00318 ** $Log: dcdatset.h,v $ 00319 ** Revision 1.36 2010-10-14 13:15:40 joergr 00320 ** Updated copyright header. Added reference to COPYRIGHT file. 00321 ** 00322 ** Revision 1.35 2010-10-08 08:37:00 joergr 00323 ** Enhanced documentation on pixel-related parameters. 00324 ** 00325 ** Revision 1.34 2010-10-05 16:20:47 joergr 00326 ** Fixed various Doxygen API documentation issues. 00327 ** 00328 ** Revision 1.33 2010-03-01 09:08:44 uli 00329 ** Removed some unnecessary include directives in the headers. 00330 ** 00331 ** Revision 1.32 2010-02-22 11:39:53 uli 00332 ** Remove some unneeded includes. 00333 ** 00334 ** Revision 1.31 2009-08-25 13:00:52 joergr 00335 ** Added new methods which remove all data elements with an invalid group number 00336 ** from the meta information header, dataset and/or fileformat. 00337 ** 00338 ** Revision 1.30 2008-07-17 11:19:48 onken 00339 ** Updated copyFrom() documentation. 00340 ** 00341 ** Revision 1.29 2008-07-17 10:30:22 onken 00342 ** Implemented copyFrom() method for complete DcmObject class hierarchy, which 00343 ** permits setting an instance's value from an existing object. Implemented 00344 ** assignment operator where necessary. 00345 ** 00346 ** Revision 1.28 2008-06-23 12:09:13 joergr 00347 ** Fixed inconsistencies in Doxygen API documentation. 00348 ** 00349 ** Revision 1.27 2007/11/29 14:30:19 meichel 00350 ** Write methods now handle large raw data elements (such as pixel data) 00351 ** without loading everything into memory. This allows very large images to 00352 ** be sent over a network connection, or to be copied without ever being 00353 ** fully in memory. 00354 ** 00355 ** Revision 1.26 2006/08/15 15:49:56 meichel 00356 ** Updated all code in module dcmdata to correctly compile when 00357 ** all standard C++ classes remain in namespace std. 00358 ** 00359 ** Revision 1.25 2005/12/08 16:28:02 meichel 00360 ** Changed include path schema for all DCMTK header files 00361 ** 00362 ** Revision 1.24 2005/11/11 10:31:57 meichel 00363 ** Added explicit DcmDataset::clear() implementation. 00364 ** 00365 ** Revision 1.23 2004/07/01 12:28:25 meichel 00366 ** Introduced virtual clone method for DcmObject and derived classes. 00367 ** 00368 ** Revision 1.22 2003/03/21 13:06:46 meichel 00369 ** Minor code purifications for warnings reported by MSVC in Level 4 00370 ** 00371 ** Revision 1.21 2002/12/09 09:31:13 wilkens 00372 ** Modified/Added doc++ documentation. 00373 ** 00374 ** Revision 1.20 2002/12/06 12:49:08 joergr 00375 ** Enhanced "print()" function by re-working the implementation and replacing 00376 ** the boolean "showFullData" parameter by a more general integer flag. 00377 ** Added doc++ documentation. 00378 ** Made source code formatting more consistent with other modules/files. 00379 ** 00380 ** Revision 1.19 2002/08/27 16:55:30 meichel 00381 ** Initial release of new DICOM I/O stream classes that add support for stream 00382 ** compression (deflated little endian explicit VR transfer syntax) 00383 ** 00384 ** Revision 1.18 2002/04/25 09:40:13 joergr 00385 ** Added support for XML output of DICOM objects. 00386 ** 00387 ** Revision 1.17 2002/04/11 12:22:52 joergr 00388 ** Added new methods for loading and saving DICOM files. 00389 ** 00390 ** Revision 1.16 2001/09/25 17:19:24 meichel 00391 ** Adapted dcmdata to class OFCondition 00392 ** 00393 ** Revision 1.15 2001/06/01 15:48:34 meichel 00394 ** Updated copyright header 00395 ** 00396 ** Revision 1.14 2000/11/07 16:56:05 meichel 00397 ** Initial release of dcmsign module for DICOM Digital Signatures 00398 ** 00399 ** Revision 1.13 2000/04/14 15:31:31 meichel 00400 ** Removed default value from output stream passed to print() method. 00401 ** Required for use in multi-thread environments. 00402 ** 00403 ** Revision 1.12 2000/03/08 16:26:12 meichel 00404 ** Updated copyright header. 00405 ** 00406 ** Revision 1.11 2000/03/03 14:05:22 meichel 00407 ** Implemented library support for redirecting error messages into memory 00408 ** instead of printing them to stdout/stderr for GUI applications. 00409 ** 00410 ** Revision 1.10 2000/02/10 10:50:50 joergr 00411 ** Added new feature to dcmdump (enhanced print method of dcmdata): write 00412 ** pixel data/item value fields to raw files. 00413 ** 00414 ** Revision 1.9 1999/03/31 09:24:32 meichel 00415 ** Updated copyright header in module dcmdata 00416 ** 00417 ** Revision 1.8 1997/07/21 08:14:38 andreas 00418 ** - New environment for encapsulated pixel representations. DcmPixelData 00419 ** can contain different representations and uses codecs to convert 00420 ** between them. Codecs are derived from the DcmCodec class. New error 00421 ** codes are introduced for handling of representations. New internal 00422 ** value representation (only for ident()) for PixelData 00423 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL) 00424 ** with one unique boolean type OFBool. 00425 ** 00426 ** Revision 1.7 1997/05/27 13:48:26 andreas 00427 ** - Add method canWriteXfer to class DcmObject and all derived classes. 00428 ** This method checks whether it is possible to convert the original 00429 ** transfer syntax to an new transfer syntax. The check is used in the 00430 ** dcmconv utility to prohibit the change of a compressed transfer 00431 ** syntax to a uncompressed. 00432 ** 00433 ** Revision 1.6 1997/05/16 08:23:45 andreas 00434 ** - Revised handling of GroupLength elements and support of 00435 ** DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding 00436 ** got additional enumeration values (for a description see dctypes.h). 00437 ** addGroupLength and removeGroupLength methods are replaced by 00438 ** computeGroupLengthAndPadding. To support Padding, the parameters of 00439 ** element and sequence write functions changed. 00440 ** - Added a new method calcElementLength to calculate the length of an 00441 ** element, item or sequence. For elements it returns the length of 00442 ** tag, length field, vr field, and value length, for item and 00443 ** sequences it returns the length of the whole item. sequence including 00444 ** the Delimitation tag (if appropriate). It can never return 00445 ** UndefinedLength. 00446 ** 00447 ** Revision 1.5 1996/08/05 08:45:17 andreas 00448 ** new print routine with additional parameters: 00449 ** - print into files 00450 ** - fix output length for elements 00451 ** corrected error in search routine with parameter ESM_fromStackTop 00452 ** 00453 ** Revision 1.4 1996/01/09 11:06:14 andreas 00454 ** New Support for Visual C++ 00455 ** Correct problems with inconsistent const declarations 00456 ** 00457 ** Revision 1.3 1996/01/05 13:22:52 andreas 00458 ** - changed to support new streaming facilities 00459 ** - more cleanups 00460 ** - merged read / write methods for block and file transfer 00461 ** 00462 */