]> Creatis software - gdcm.git/blob - src/gdcmHeader.h
* Erroneous leading white fix:
[gdcm.git] / src / gdcmHeader.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmHeader.h,v $
5   Language:  C++
6   Date:      $Date: 2004/06/20 18:08:48 $
7   Version:   $Revision: 1.74 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #ifndef GDCMHEADER_H
20 #define GDCMHEADER_H
21
22 #include "gdcmCommon.h"
23 #include "gdcmDocument.h"
24 //-----------------------------------------------------------------------------
25 /**
26  * \brief
27  * The purpose of an instance of gdcmHeader is to act as a container of
28  * all the DICOM elements and their corresponding values (and
29  * additionaly the corresponding DICOM dictionary entry) of the header
30  * of a DICOM file.
31  *
32  * The typical usage of instances of class gdcmHeader is to classify a set of
33  * dicom files according to header information e.g. to create a file hierarchy
34  * reflecting the Patient/Study/Serie informations, or extracting a given
35  * SerieId. Accessing the content (image[s] or volume[s]) is beyond the
36  * functionality of this class and belongs to gdmcFile.
37  * \note  The various entries of the explicit value representation (VR) shall
38  *        be managed within a dictionary which is shared by all gdcmHeader
39  *        instances.
40  * \note  The gdcmHeader::Set*Tag* family members cannot be defined as
41  *        protected due to Swig limitations for as Has_a dependency between
42  *        gdcmFile and gdcmHeader.
43  */
44 class GDCM_EXPORT gdcmHeader : public gdcmDocument
45 {
46 protected:
47    /// \brief In some cases (e.g. for some ACR-NEMA images) the Header Entry Element
48    /// Number of the 'Pixel Element' is *not* found at 0x0010. In order to
49    /// make things easier the parser shall store the proper value in
50    /// NumPixel to provide a unique access facility. See also the constructor
51    /// \ref gdcmHeader::gdcmHeader
52    guint16 NumPixel;
53    /// \brief In some cases (e.g. for some ACR-NEMA images) the header entry for
54    /// the group of pixels is *not* found at 0x7fe0. In order to
55    /// make things easier the parser shall store the proper value in
56    /// GrPixel to provide a unique access facility. See also the constructor
57    /// \ref gdcmHeader::gdcmHeader
58    guint16 GrPixel;
59
60 public:
61    gdcmHeader(bool exception_on_error = false);
62    gdcmHeader(const char *filename, 
63               bool  exception_on_error = false, 
64               bool  enable_sequences   = false,
65               bool  skip_shadow        = false);
66  
67    virtual ~gdcmHeader();
68
69    // Standard values and informations contained in the header
70    virtual bool IsReadable(void);
71
72    // Some heuristic based accessors, end user intended 
73    // (to be moved to gdcmHeaderHelper?) 
74    int GetXSize(void);
75    int GetYSize(void);
76    int GetZSize(void);
77    int GetBitsStored(void);
78    int GetBitsAllocated(void);
79    int GetSamplesPerPixel(void);   
80    int GetPlanarConfiguration(void);
81
82    int GetPixelSize(void);   
83    std::string GetPixelType(void);  
84    size_t GetPixelOffset(void);
85    size_t GetPixelAreaLength(void);
86
87    bool   HasLUT(void);
88    int    GetLUTNbits(void);
89    unsigned char * GetLUTRGBA(void);
90
91    std::string GetTransfertSyntaxName(void);
92
93    /// Accessor to \ref gdcmHeader::GrPixel
94    guint16 GetGrPixel(void)  {return GrPixel;}
95    
96    /// Accessor to \ref gdcmHeader::NumPixel
97    guint16 GetNumPixel(void) {return NumPixel;}
98
99    /// Read (used in gdcmFile)
100    void SetImageDataSize(size_t ExpectedSize);
101
102 protected:
103    bool anonymizeHeader(void);
104 private:
105
106 };
107
108 //-----------------------------------------------------------------------------
109 #endif