dcmimgle/include/dcmtk/dcmimgle/didocu.h

00001 /*
00002  *
00003  *  Copyright (C) 1996-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:  dcmimgle
00015  *
00016  *  Author:  Joerg Riesmeier
00017  *
00018  *  Purpose: DicomDocument (Header)
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:16:26 $
00022  *  CVS/RCS Revision: $Revision: 1.22 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 
00030 #ifndef DIDOCU_H
00031 #define DIDOCU_H
00032 
00033 #include "dcmtk/config/osconfig.h"
00034 
00035 #include "dcmtk/dcmdata/dctypes.h"
00036 #include "dcmtk/dcmdata/dcfilefo.h"
00037 #include "dcmtk/dcmdata/dcxfer.h"
00038 #include "dcmtk/dcmimgle/diobjcou.h"
00039 #include "dcmtk/ofstd/ofstring.h"
00040 
00041 #define INCLUDE_CSTDDEF
00042 #include "dcmtk/ofstd/ofstdinc.h"
00043 
00044 
00045 /*------------------------*
00046  *  forward declarations  *
00047  *------------------------*/
00048 
00049 class DcmStack;
00050 class DcmObject;
00051 class DcmTagKey;
00052 class DcmElement;
00053 class DcmPixelData;
00054 class DcmSequenceOfItems;
00055 
00056 
00057 /*---------------------*
00058  *  class declaration  *
00059  *---------------------*/
00060 
00066 class DiDocument
00067   : public DiObjectCounter
00068 {
00069 
00070  public:
00071 
00079     DiDocument(const char *filename,
00080                const unsigned long flags = 0,
00081                const unsigned long fstart = 0,
00082                const unsigned long fcount = 0);
00083 
00092     DiDocument(DcmObject *object,
00093                const E_TransferSyntax xfer,
00094                const unsigned long flags = 0,
00095                const unsigned long fstart = 0,
00096                const unsigned long fcount = 0);
00097 
00100     virtual ~DiDocument();
00101 
00106     inline int good() const
00107     {
00108         return Object != NULL;
00109     }
00110 
00115     inline DcmObject *getDicomObject() const
00116     {
00117         return Object;
00118     }
00119 
00124     inline DcmDataset *getDataset() const
00125     {
00126         return OFstatic_cast(DcmDataset *, Object);
00127     }
00128 
00133     inline unsigned long getFrameStart() const
00134     {
00135         return FrameStart;
00136     }
00137 
00142     inline unsigned long getFrameCount() const
00143     {
00144         return FrameCount;
00145     }
00146 
00151     inline unsigned long getFlags() const
00152     {
00153         return Flags;
00154     }
00155 
00160     inline E_TransferSyntax getTransferSyntax() const
00161     {
00162         return Xfer;
00163     }
00164 
00171     inline const char *getPhotometricInterpretation() const
00172     {
00173         return PhotometricInterpretation.c_str();
00174     }
00175 
00180     inline DcmPixelData *getPixelData() const
00181     {
00182         return PixelData;
00183     }
00184 
00189     inline OFBool isCompressed() const
00190     {
00191         return DcmXfer(Xfer).isEncapsulated();
00192     }
00193 
00201     DcmElement *search(const DcmTagKey &tag,
00202                        DcmObject *obj = NULL) const;
00203 
00211     int search(const DcmTagKey &tag,
00212                DcmStack &stack) const;
00213 
00214 
00221     unsigned long getVM(const DcmTagKey &tag) const;
00222 
00233     unsigned long getValue(const DcmTagKey &tag,
00234                            Uint16 &returnVal,
00235                            const unsigned long pos = 0,
00236                            DcmObject *item = NULL,
00237                            const OFBool allowSigned = OFFalse) const;
00238 
00247     unsigned long getValue(const DcmTagKey &tag,
00248                            Sint16 &returnVal,
00249                            const unsigned long pos = 0) const;
00250 
00259     unsigned long getValue(const DcmTagKey &tag,
00260                            Uint32 &returnVal,
00261                            const unsigned long pos = 0) const;
00262 
00271     unsigned long getValue(const DcmTagKey &tag,
00272                            Sint32 &returnVal,
00273                            const unsigned long pos = 0) const;
00274 
00283     unsigned long getValue(const DcmTagKey &tag,
00284                            double &returnVal,
00285                            const unsigned long pos = 0) const;
00286 
00295     unsigned long getValue(const DcmTagKey &tag,
00296                            const Uint16 *&returnVal,
00297                            DcmObject *item = NULL) const;
00298 
00307     unsigned long getValue(const DcmTagKey &tag,
00308                            const char *&returnVal,
00309                            DcmObject *item = NULL) const;
00310 
00320     unsigned long getValue(const DcmTagKey &tag,
00321                            OFString &returnVal,
00322                            const unsigned long pos = 0,
00323                            DcmObject *item = NULL) const;
00324 
00332     unsigned long getSequence(const DcmTagKey &tag,
00333                               DcmSequenceOfItems *&seq) const;
00334 
00335   // --- static helper functions ---
00336 
00346     static unsigned long getElemValue(const DcmElement *elem,
00347                                       Uint16 &returnVal,
00348                                       const unsigned long pos = 0,
00349                                       const OFBool allowSigned = OFFalse);
00350 
00358     static unsigned long getElemValue(const DcmElement *elem,
00359                                       const Uint16 *&returnVal);
00360 
00368     static unsigned long getElemValue(const DcmElement *elem,
00369                                       const char *&returnVal);
00370 
00379     static unsigned long getElemValue(const DcmElement *elem,
00380                                       OFString &returnVal,
00381                                       const unsigned long pos = 0);
00382 
00383 
00384  protected:
00385 
00388     void convertPixelData();
00389 
00390 
00391  private:
00392 
00394     DcmObject *Object;
00396     DcmFileFormat *FileFormat;
00398     DcmPixelData *PixelData;
00400     E_TransferSyntax Xfer;
00401 
00403     unsigned long FrameStart;
00405     unsigned long FrameCount;
00406 
00408     unsigned long Flags;
00409 
00411     OFString PhotometricInterpretation;
00412 
00413  // --- declarations to avoid compiler warnings
00414 
00415     DiDocument(const DiDocument &);
00416     DiDocument &operator=(const DiDocument &);
00417 };
00418 
00419 
00420 #endif
00421 
00422 
00423 /*
00424  *
00425  * CVS/RCS Log:
00426  * $Log: didocu.h,v $
00427  * Revision 1.22  2010-10-14 13:16:26  joergr
00428  * Updated copyright header. Added reference to COPYRIGHT file.
00429  *
00430  * Revision 1.21  2009-11-25 15:53:40  joergr
00431  * dapted code for new approach to access individual frames of a DICOM image.
00432  * Fixed issue with attributes that use a value representation of US or SS.
00433  *
00434  * Revision 1.20  2007/07/25 15:11:43  joergr
00435  * Enhanced misleading documentation.
00436  *
00437  * Revision 1.19  2005/12/08 16:47:38  meichel
00438  * Changed include path schema for all DCMTK header files
00439  *
00440  * Revision 1.18  2003/12/08 18:20:13  joergr
00441  * Added comment that class DiDocument is meant for internal purposes only.
00442  * Removed leading underscore characters from preprocessor symbols (reserved
00443  * symbols). Updated CVS header.
00444  *
00445  * Revision 1.17  2003/07/04 13:25:54  meichel
00446  * Replaced forward declarations for OFString with explicit includes,
00447  *   needed when compiling with HAVE_STD_STRING
00448  *
00449  * Revision 1.16  2003/06/12 15:08:34  joergr
00450  * Fixed inconsistent API documentation reported by Doxygen.
00451  *
00452  * Revision 1.15  2002/11/27 14:08:03  meichel
00453  * Adapted module dcmimgle to use of new header file ofstdinc.h
00454  *
00455  * Revision 1.14  2002/08/21 09:51:44  meichel
00456  * Removed DicomImage and DiDocument constructors that take a DcmStream
00457  *   parameter
00458  *
00459  * Revision 1.13  2002/06/26 16:01:07  joergr
00460  * Added new methods to get the explanation string of stored VOI windows and
00461  * LUTs (not only of the currently selected VOI transformation).
00462  *
00463  * Revision 1.12  2001/11/29 16:56:51  joergr
00464  * Fixed bug in dcmimgle that caused incorrect decoding of some JPEG compressed
00465  * images (certain DICOM attributes, e.g. photometric interpretation, might
00466  * change during decompression process).
00467  *
00468  * Revision 1.11  2001/11/19 12:55:29  joergr
00469  * Adapted code to support new dcmjpeg module and JPEG compressed images.
00470  *
00471  * Revision 1.10  2001/06/01 15:49:41  meichel
00472  * Updated copyright header
00473  *
00474  * Revision 1.9  2000/09/12 10:04:43  joergr
00475  * Corrected bug: wrong parameter for attribute search routine led to crashes
00476  * when multiple pixel data attributes were contained in the dataset (e.g.
00477  * IconImageSequence). Added new checking routines to avoid crashes when
00478  * processing corrupted image data.
00479  *
00480  * Revision 1.8  2000/03/08 16:24:15  meichel
00481  * Updated copyright header.
00482  *
00483  * Revision 1.7  2000/02/02 11:02:37  joergr
00484  * Removed space characters before preprocessor directives.
00485  *
00486  * Revision 1.6  1999/09/17 12:09:20  joergr
00487  * Added/changed/completed DOC++ style comments in the header files.
00488  *
00489  * Revision 1.5  1999/03/24 17:19:59  joergr
00490  * Added/Modified comments and formatting.
00491  *
00492  * Revision 1.4  1999/02/03 17:00:33  joergr
00493  * Added BEGIN_EXTERN_C and END_EXTERN_C to some C includes.
00494  *
00495  * Revision 1.3  1998/12/16 16:26:52  joergr
00496  * Added methods to use getOFString from class DcmElement (incl. multi value
00497  * fields).
00498  *
00499  * Revision 1.2  1998/12/14 17:16:32  joergr
00500  * Added (simplified) methods to return values of a given DcmElement object.
00501  *
00502  * Revision 1.1  1998/11/27 14:53:59  joergr
00503  * Added copyright message.
00504  * Added static methods to return the value of a given element.
00505  * Added support of frame start and count for future use.
00506  *
00507  * Revision 1.7  1998/07/01 08:39:20  joergr
00508  * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional
00509  * options), e.g. add copy constructors.
00510  *
00511  * Revision 1.6  1998/06/25 08:50:09  joergr
00512  * Added compatibility mode to support ACR-NEMA images and wrong
00513  * palette attribute tags.
00514  *
00515  * Revision 1.5  1998/05/11 14:53:15  joergr
00516  * Added CVS/RCS header to each file.
00517  *
00518  *
00519  */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1