OFFIS DCMTK  Version 3.6.0
dcmetinf.h
1 /*
2  *
3  * Copyright (C) 1994-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: dcmdata
15  *
16  * Author: Gerd Ehlers, Andreas Barth
17  *
18  * Purpose: Interface of class DcmMetaInfo
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:15:41 $
22  * CVS/RCS Revision: $Revision: 1.33 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DCMETINF_H
31 #define DCMETINF_H
32 
33 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
34 
35 #include "dcmtk/dcmdata/dcitem.h"
36 
37 
39 #define DCM_Magic "DICM"
40 
42 #define DCM_MagicLen 4
43 
45 #define DCM_PreambleLen 128
46 
48 #define META_HEADER_DEFAULT_TRANSFERSYNTAX EXS_LittleEndianExplicit
49 
50 
54  : public DcmItem
55 {
56 
57  public:
58 
61  DcmMetaInfo();
62 
66  DcmMetaInfo(const DcmMetaInfo &old);
67 
71  DcmMetaInfo &operator=(const DcmMetaInfo &obj);
72 
75  virtual ~DcmMetaInfo();
76 
80  virtual DcmObject *clone() const
81  {
82  return new DcmMetaInfo(*this);
83  }
84 
97  virtual OFCondition copyFrom(const DcmObject& rhs);
98 
102  virtual DcmEVR ident() const;
103 
106  virtual void removeInvalidGroups();
107 
111  E_TransferSyntax getOriginalXfer() const;
112 
120  virtual void print(STD_NAMESPACE ostream&out,
121  const size_t flags = 0,
122  const int level = 0,
123  const char *pixelFileName = NULL,
124  size_t *pixelCounter = NULL);
125 
129  virtual void transferInit();
130 
134  virtual void transferEnd();
135 
146  virtual Uint32 calcElementLength(const E_TransferSyntax xfer,
147  const E_EncodingType enctype);
148 
158  virtual OFCondition read(DcmInputStream &inStream,
159  const E_TransferSyntax xfer = EXS_Unknown,
160  const E_GrpLenEncoding glenc = EGL_noChange,
161  const Uint32 maxReadLength = DCM_MaxReadLength);
162 
170  virtual OFCondition write(DcmOutputStream &outStream,
171  const E_TransferSyntax oxfer,
172  const E_EncodingType enctype,
173  DcmWriteCache *wcache);
174 
180  virtual OFCondition writeXML(STD_NAMESPACE ostream&out,
181  const size_t flags = 0);
182 
192  virtual OFCondition loadFile(const char *fileName,
193  const E_TransferSyntax readXfer = EXS_Unknown,
194  const E_GrpLenEncoding groupLength = EGL_noChange,
195  const Uint32 maxReadLength = DCM_MaxReadLength);
196 
197 
198  private:
199 
201  void setPreamble();
202 
213  OFBool checkAndReadPreamble(DcmInputStream &inStream,
214  E_TransferSyntax &newxfer); // out
215 
220  OFBool nextTagIsMeta(DcmInputStream &inStream);
221 
234  OFCondition readGroupLength(DcmInputStream &inStream, // inout
235  const E_TransferSyntax xfer, // in
236  const DcmTagKey &xtag, // in
237  const E_GrpLenEncoding glenc, // in
238  Uint32 &headerLen, // out
239  Uint32 &bytesRead, // out
240  const Uint32 maxReadLength = DCM_MaxReadLength); // in
241 
243  char filePreamble[DCM_PreambleLen + DCM_MagicLen];
244 
246  OFBool preambleUsed;
247 
249  E_TransferState fPreambleTransferState;
250 
252  E_TransferSyntax Xfer;
253 
254 };
255 
256 #endif // DCMETINF_H
257 
258 /*
259 ** CVS/RCS Log:
260 ** $Log: dcmetinf.h,v $
261 ** Revision 1.33 2010-10-14 13:15:41 joergr
262 ** Updated copyright header. Added reference to COPYRIGHT file.
263 **
264 ** Revision 1.32 2010-06-07 13:54:13 joergr
265 ** Added new method that allows for loading the meta-header only.
266 **
267 ** Revision 1.31 2010-03-01 09:08:44 uli
268 ** Removed some unnecessary include directives in the headers.
269 **
270 ** Revision 1.30 2010-02-22 11:39:54 uli
271 ** Remove some unneeded includes.
272 **
273 ** Revision 1.29 2009-08-25 13:00:52 joergr
274 ** Added new methods which remove all data elements with an invalid group number
275 ** from the meta information header, dataset and/or fileformat.
276 **
277 ** Revision 1.28 2008-07-17 11:19:48 onken
278 ** Updated copyFrom() documentation.
279 **
280 ** Revision 1.27 2008-07-17 10:30:23 onken
281 ** Implemented copyFrom() method for complete DcmObject class hierarchy, which
282 ** permits setting an instance's value from an existing object. Implemented
283 ** assignment operator where necessary.
284 **
285 ** Revision 1.26 2008-06-23 12:09:13 joergr
286 ** Fixed inconsistencies in Doxygen API documentation.
287 **
288 ** Revision 1.25 2007/11/29 14:30:19 meichel
289 ** Write methods now handle large raw data elements (such as pixel data)
290 ** without loading everything into memory. This allows very large images to
291 ** be sent over a network connection, or to be copied without ever being
292 ** fully in memory.
293 **
294 ** Revision 1.24 2007/02/19 14:57:22 meichel
295 ** Declaration of copy assignment operator now private, as it should be
296 **
297 ** Revision 1.23 2006/08/15 15:49:56 meichel
298 ** Updated all code in module dcmdata to correctly compile when
299 ** all standard C++ classes remain in namespace std.
300 **
301 ** Revision 1.22 2005/12/08 16:28:21 meichel
302 ** Changed include path schema for all DCMTK header files
303 **
304 ** Revision 1.21 2005/11/07 16:59:24 meichel
305 ** Cleaned up some copy constructors in the DcmObject hierarchy.
306 **
307 ** Revision 1.20 2004/07/01 12:28:25 meichel
308 ** Introduced virtual clone method for DcmObject and derived classes.
309 **
310 ** Revision 1.19 2003/03/21 13:06:46 meichel
311 ** Minor code purifications for warnings reported by MSVC in Level 4
312 **
313 ** Revision 1.18 2002/12/06 12:49:11 joergr
314 ** Enhanced "print()" function by re-working the implementation and replacing
315 ** the boolean "showFullData" parameter by a more general integer flag.
316 ** Added doc++ documentation.
317 ** Made source code formatting more consistent with other modules/files.
318 **
319 ** Revision 1.17 2002/08/27 16:55:35 meichel
320 ** Initial release of new DICOM I/O stream classes that add support for stream
321 ** compression (deflated little endian explicit VR transfer syntax)
322 **
323 ** Revision 1.16 2002/04/25 09:40:56 joergr
324 ** Added support for XML output of DICOM objects.
325 **
326 ** Revision 1.15 2001/09/25 17:19:27 meichel
327 ** Adapted dcmdata to class OFCondition
328 **
329 ** Revision 1.14 2001/06/01 15:48:41 meichel
330 ** Updated copyright header
331 **
332 ** Revision 1.13 2000/04/14 15:31:32 meichel
333 ** Removed default value from output stream passed to print() method.
334 ** Required for use in multi-thread environments.
335 **
336 ** Revision 1.12 2000/03/08 16:26:16 meichel
337 ** Updated copyright header.
338 **
339 ** Revision 1.11 2000/03/03 14:05:24 meichel
340 ** Implemented library support for redirecting error messages into memory
341 ** instead of printing them to stdout/stderr for GUI applications.
342 **
343 ** Revision 1.10 2000/02/10 10:50:51 joergr
344 ** Added new feature to dcmdump (enhanced print method of dcmdata): write
345 ** pixel data/item value fields to raw files.
346 **
347 ** Revision 1.9 1999/03/31 09:24:41 meichel
348 ** Updated copyright header in module dcmdata
349 **
350 ** Revision 1.8 1997/09/22 14:56:12 hewett
351 ** Added a method to retreive the original transfer syntax of a read
352 ** meta-header (getOriginalXfer). This functionality is needed by
353 ** the DCMCHECK package.
354 **
355 ** Revision 1.7 1997/07/21 08:25:09 andreas
356 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL)
357 ** with one unique boolean type OFBool.
358 **
359 ** Revision 1.6 1997/05/16 08:23:47 andreas
360 ** - Revised handling of GroupLength elements and support of
361 ** DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding
362 ** got additional enumeration values (for a description see dctypes.h).
363 ** addGroupLength and removeGroupLength methods are replaced by
364 ** computeGroupLengthAndPadding. To support Padding, the parameters of
365 ** element and sequence write functions changed.
366 ** - Added a new method calcElementLength to calculate the length of an
367 ** element, item or sequence. For elements it returns the length of
368 ** tag, length field, vr field, and value length, for item and
369 ** sequences it returns the length of the whole item. sequence including
370 ** the Delimitation tag (if appropriate). It can never return
371 ** UndefinedLength.
372 **
373 ** Revision 1.5 1996/08/05 08:45:24 andreas
374 ** new print routine with additional parameters:
375 ** - print into files
376 ** - fix output length for elements
377 ** corrected error in search routine with parameter ESM_fromStackTop
378 **
379 ** Revision 1.4 1996/01/09 11:06:16 andreas
380 ** New Support for Visual C++
381 ** Correct problems with inconsistent const declarations
382 **
383 ** Revision 1.3 1996/01/05 13:22:57 andreas
384 ** - changed to support new streaming facilities
385 ** - more cleanups
386 ** - merged read / write methods for block and file transfer
387 **
388 */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2