OFFIS DCMTK  Version 3.6.0
didocu.h
1 /*
2  *
3  * Copyright (C) 1996-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: dcmimgle
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: DicomDocument (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:26 $
22  * CVS/RCS Revision: $Revision: 1.22 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DIDOCU_H
31 #define DIDOCU_H
32 
33 #include "dcmtk/config/osconfig.h"
34 
35 #include "dcmtk/dcmdata/dctypes.h"
36 #include "dcmtk/dcmdata/dcfilefo.h"
37 #include "dcmtk/dcmdata/dcxfer.h"
38 #include "dcmtk/dcmimgle/diobjcou.h"
39 #include "dcmtk/ofstd/ofstring.h"
40 
41 #define INCLUDE_CSTDDEF
42 #include "dcmtk/ofstd/ofstdinc.h"
43 
44 
45 /*------------------------*
46  * forward declarations *
47  *------------------------*/
48 
49 class DcmStack;
50 class DcmObject;
51 class DcmTagKey;
52 class DcmElement;
53 class DcmPixelData;
54 class DcmSequenceOfItems;
55 
56 
57 /*---------------------*
58  * class declaration *
59  *---------------------*/
60 
67  : public DiObjectCounter
68 {
69 
70  public:
71 
79  DiDocument(const char *filename,
80  const unsigned long flags = 0,
81  const unsigned long fstart = 0,
82  const unsigned long fcount = 0);
83 
92  DiDocument(DcmObject *object,
93  const E_TransferSyntax xfer,
94  const unsigned long flags = 0,
95  const unsigned long fstart = 0,
96  const unsigned long fcount = 0);
97 
100  virtual ~DiDocument();
101 
106  inline int good() const
107  {
108  return Object != NULL;
109  }
110 
115  inline DcmObject *getDicomObject() const
116  {
117  return Object;
118  }
119 
124  inline DcmDataset *getDataset() const
125  {
126  return OFstatic_cast(DcmDataset *, Object);
127  }
128 
133  inline unsigned long getFrameStart() const
134  {
135  return FrameStart;
136  }
137 
142  inline unsigned long getFrameCount() const
143  {
144  return FrameCount;
145  }
146 
151  inline unsigned long getFlags() const
152  {
153  return Flags;
154  }
155 
160  inline E_TransferSyntax getTransferSyntax() const
161  {
162  return Xfer;
163  }
164 
171  inline const char *getPhotometricInterpretation() const
172  {
174  }
175 
180  inline DcmPixelData *getPixelData() const
181  {
182  return PixelData;
183  }
184 
189  inline OFBool isCompressed() const
190  {
191  return DcmXfer(Xfer).isEncapsulated();
192  }
193 
201  DcmElement *search(const DcmTagKey &tag,
202  DcmObject *obj = NULL) const;
203 
211  int search(const DcmTagKey &tag,
212  DcmStack &stack) const;
213 
214 
221  unsigned long getVM(const DcmTagKey &tag) const;
222 
233  unsigned long getValue(const DcmTagKey &tag,
234  Uint16 &returnVal,
235  const unsigned long pos = 0,
236  DcmObject *item = NULL,
237  const OFBool allowSigned = OFFalse) const;
238 
247  unsigned long getValue(const DcmTagKey &tag,
248  Sint16 &returnVal,
249  const unsigned long pos = 0) const;
250 
259  unsigned long getValue(const DcmTagKey &tag,
260  Uint32 &returnVal,
261  const unsigned long pos = 0) const;
262 
271  unsigned long getValue(const DcmTagKey &tag,
272  Sint32 &returnVal,
273  const unsigned long pos = 0) const;
274 
283  unsigned long getValue(const DcmTagKey &tag,
284  double &returnVal,
285  const unsigned long pos = 0) const;
286 
295  unsigned long getValue(const DcmTagKey &tag,
296  const Uint16 *&returnVal,
297  DcmObject *item = NULL) const;
298 
307  unsigned long getValue(const DcmTagKey &tag,
308  const char *&returnVal,
309  DcmObject *item = NULL) const;
310 
320  unsigned long getValue(const DcmTagKey &tag,
321  OFString &returnVal,
322  const unsigned long pos = 0,
323  DcmObject *item = NULL) const;
324 
332  unsigned long getSequence(const DcmTagKey &tag,
333  DcmSequenceOfItems *&seq) const;
334 
335  // --- static helper functions ---
336 
346  static unsigned long getElemValue(const DcmElement *elem,
347  Uint16 &returnVal,
348  const unsigned long pos = 0,
349  const OFBool allowSigned = OFFalse);
350 
358  static unsigned long getElemValue(const DcmElement *elem,
359  const Uint16 *&returnVal);
360 
368  static unsigned long getElemValue(const DcmElement *elem,
369  const char *&returnVal);
370 
379  static unsigned long getElemValue(const DcmElement *elem,
380  OFString &returnVal,
381  const unsigned long pos = 0);
382 
383 
384  protected:
385 
388  void convertPixelData();
389 
390 
391  private:
392 
400  E_TransferSyntax Xfer;
401 
403  unsigned long FrameStart;
405  unsigned long FrameCount;
406 
408  unsigned long Flags;
409 
412 
413  // --- declarations to avoid compiler warnings
414 
415  DiDocument(const DiDocument &);
416  DiDocument &operator=(const DiDocument &);
417 };
418 
419 
420 #endif
421 
422 
423 /*
424  *
425  * CVS/RCS Log:
426  * $Log: didocu.h,v $
427  * Revision 1.22 2010-10-14 13:16:26 joergr
428  * Updated copyright header. Added reference to COPYRIGHT file.
429  *
430  * Revision 1.21 2009-11-25 15:53:40 joergr
431  * dapted code for new approach to access individual frames of a DICOM image.
432  * Fixed issue with attributes that use a value representation of US or SS.
433  *
434  * Revision 1.20 2007/07/25 15:11:43 joergr
435  * Enhanced misleading documentation.
436  *
437  * Revision 1.19 2005/12/08 16:47:38 meichel
438  * Changed include path schema for all DCMTK header files
439  *
440  * Revision 1.18 2003/12/08 18:20:13 joergr
441  * Added comment that class DiDocument is meant for internal purposes only.
442  * Removed leading underscore characters from preprocessor symbols (reserved
443  * symbols). Updated CVS header.
444  *
445  * Revision 1.17 2003/07/04 13:25:54 meichel
446  * Replaced forward declarations for OFString with explicit includes,
447  * needed when compiling with HAVE_STD_STRING
448  *
449  * Revision 1.16 2003/06/12 15:08:34 joergr
450  * Fixed inconsistent API documentation reported by Doxygen.
451  *
452  * Revision 1.15 2002/11/27 14:08:03 meichel
453  * Adapted module dcmimgle to use of new header file ofstdinc.h
454  *
455  * Revision 1.14 2002/08/21 09:51:44 meichel
456  * Removed DicomImage and DiDocument constructors that take a DcmStream
457  * parameter
458  *
459  * Revision 1.13 2002/06/26 16:01:07 joergr
460  * Added new methods to get the explanation string of stored VOI windows and
461  * LUTs (not only of the currently selected VOI transformation).
462  *
463  * Revision 1.12 2001/11/29 16:56:51 joergr
464  * Fixed bug in dcmimgle that caused incorrect decoding of some JPEG compressed
465  * images (certain DICOM attributes, e.g. photometric interpretation, might
466  * change during decompression process).
467  *
468  * Revision 1.11 2001/11/19 12:55:29 joergr
469  * Adapted code to support new dcmjpeg module and JPEG compressed images.
470  *
471  * Revision 1.10 2001/06/01 15:49:41 meichel
472  * Updated copyright header
473  *
474  * Revision 1.9 2000/09/12 10:04:43 joergr
475  * Corrected bug: wrong parameter for attribute search routine led to crashes
476  * when multiple pixel data attributes were contained in the dataset (e.g.
477  * IconImageSequence). Added new checking routines to avoid crashes when
478  * processing corrupted image data.
479  *
480  * Revision 1.8 2000/03/08 16:24:15 meichel
481  * Updated copyright header.
482  *
483  * Revision 1.7 2000/02/02 11:02:37 joergr
484  * Removed space characters before preprocessor directives.
485  *
486  * Revision 1.6 1999/09/17 12:09:20 joergr
487  * Added/changed/completed DOC++ style comments in the header files.
488  *
489  * Revision 1.5 1999/03/24 17:19:59 joergr
490  * Added/Modified comments and formatting.
491  *
492  * Revision 1.4 1999/02/03 17:00:33 joergr
493  * Added BEGIN_EXTERN_C and END_EXTERN_C to some C includes.
494  *
495  * Revision 1.3 1998/12/16 16:26:52 joergr
496  * Added methods to use getOFString from class DcmElement (incl. multi value
497  * fields).
498  *
499  * Revision 1.2 1998/12/14 17:16:32 joergr
500  * Added (simplified) methods to return values of a given DcmElement object.
501  *
502  * Revision 1.1 1998/11/27 14:53:59 joergr
503  * Added copyright message.
504  * Added static methods to return the value of a given element.
505  * Added support of frame start and count for future use.
506  *
507  * Revision 1.7 1998/07/01 08:39:20 joergr
508  * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional
509  * options), e.g. add copy constructors.
510  *
511  * Revision 1.6 1998/06/25 08:50:09 joergr
512  * Added compatibility mode to support ACR-NEMA images and wrong
513  * palette attribute tags.
514  *
515  * Revision 1.5 1998/05/11 14:53:15 joergr
516  * Added CVS/RCS header to each file.
517  *
518  *
519  */
unsigned long getValue(const DcmTagKey &tag, Uint16 &returnVal, const unsigned long pos=0, DcmObject *item=NULL, const OFBool allowSigned=OFFalse) const
get value of given tag (Uint16)
class maintaining a attribute tag (group and element number)
Definition: dctagkey.h:46
DcmPixelData * PixelData
reference to pixel data object
Definition: didocu.h:398
unsigned long getFrameCount() const
get number of frames to be processed
Definition: didocu.h:142
abstract base class for all DICOM elements
Definition: dcelem.h:45
class representing a DICOM Sequence of Items (SQ).
Definition: dcsequen.h:47
DiDocument(const char *filename, const unsigned long flags=0, const unsigned long fstart=0, const unsigned long fcount=0)
constructor, open a DICOM file
unsigned long getSequence(const DcmTagKey &tag, DcmSequenceOfItems *&seq) const
get sequence of given tag
Class to count number of instances (objects created from a certain class).
Definition: diobjcou.h:47
unsigned long getVM(const DcmTagKey &tag) const
get value multiplicity (VM) of given tag
a class handling the DICOM file format (with meta header)
Definition: dcfilefo.h:48
The class DcmPixelData stores different pixel representations identified by a type (the transfer synt...
Definition: dcpixel.h:153
Interface class to DICOM data management (dcmdata).
Definition: didocu.h:66
DcmElement * search(const DcmTagKey &tag, DcmObject *obj=NULL) const
search for given tag
unsigned long getFrameStart() const
get first frame to be processed
Definition: didocu.h:133
DcmPixelData * getPixelData() const
get pixel data object
Definition: didocu.h:180
Abstract base class for most classes in module dcmdata.
Definition: dcobject.h:179
DcmDataset * getDataset() const
get current DICOM dataset
Definition: didocu.h:124
OFBool isCompressed() const
check whether pixel data only exist in compressed format
Definition: didocu.h:189
static unsigned long getElemValue(const DcmElement *elem, Uint16 &returnVal, const unsigned long pos=0, const OFBool allowSigned=OFFalse)
get value of given element (Uint16)
OFString PhotometricInterpretation
photometric interpretation (color model)
Definition: didocu.h:411
a class that allows for a lookup of Transfer Syntax properties and readable descriptions ...
Definition: dcxfer.h:161
E_TransferSyntax Xfer
transfer syntax used for reading the dataset
Definition: didocu.h:400
virtual ~DiDocument()
destructor
DcmObject * getDicomObject() const
get current DICOM object (dataset)
Definition: didocu.h:115
this class manages a stack of pointers to DcmObject instances.
Definition: dcstack.h:77
unsigned long FrameStart
first frame to be processed
Definition: didocu.h:403
a class handling the DICOM dataset format (files without meta header)
Definition: dcdatset.h:46
E_TransferSyntax getTransferSyntax() const
get transfer syntax of the DICOM dataset
Definition: didocu.h:160
const char * getPhotometricInterpretation() const
get photometric interpretation (color model).
Definition: didocu.h:171
OFBool isEncapsulated() const
return true if transfer syntax is encapsulated, false otherwise
Definition: dcxfer.h:214
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
const char * c_str() const
returns a pointer to the initial element of an array of length size()+1 whose first size() elements e...
Definition: ofstring.h:392
void convertPixelData()
convert pixel data to uncompressed representation (if required)
DcmFileFormat * FileFormat
reference to DICOM fileformat (read from file, maybe NULL)
Definition: didocu.h:396
int good() const
check whether current document is valid
Definition: didocu.h:106
DcmObject * Object
reference to DICOM dataset (in memory)
Definition: didocu.h:394
unsigned long Flags
configuration flags
Definition: didocu.h:408
unsigned long getFlags() const
get configuration flags
Definition: didocu.h:151
unsigned long FrameCount
number of frames to be processed
Definition: didocu.h:405


Generated on Wed Dec 14 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.11