]> Creatis software - gdcm.git/blob - src/gdcmHeader.h
1ddff5a0b1de7542a642716a93228ce19240fbb8
[gdcm.git] / src / gdcmHeader.h
1 // gdcmHeader.h
2 //-----------------------------------------------------------------------------
3 #ifndef GDCMHEADER_H
4 #define GDCMHEADER_H
5
6 #include "gdcmCommon.h"
7 #include "gdcmParser.h"
8
9 //-----------------------------------------------------------------------------
10 /*
11  * \defgroup gdcmHeader
12  * \brief
13  * The purpose of an instance of gdcmHeader is to act as a container of
14  * all the DICOM elements and their corresponding values (and
15  * additionaly the corresponding DICOM dictionary entry) of the header
16  * of a DICOM file.
17  *
18  * The typical usage of instances of class gdcmHeader is to classify a set of
19  * dicom files according to header information e.g. to create a file hierarchy
20  * reflecting the Patient/Study/Serie informations, or extracting a given
21  * SerieId. Accessing the content (image[s] or volume[s]) is beyond the
22  * functionality of this class and belongs to gdmcFile.
23  * \note  The various entries of the explicit value representation (VR) shall
24  *        be managed within a dictionary which is shared by all gdcmHeader
25  *        instances.
26  * \note  The gdcmHeader::Set*Tag* family members cannot be defined as
27  *        protected due to Swig limitations for as Has_a dependency between
28  *        gdcmFile and gdcmHeader.
29  */
30 class GDCM_EXPORT gdcmHeader : public gdcmParser
31 {
32 public:
33    gdcmHeader(bool exception_on_error = false);
34    gdcmHeader(const char *filename, 
35               bool  exception_on_error = false, 
36               bool  enable_sequences   = false);
37               
38    virtual ~gdcmHeader();
39
40 // Standard values and informations contained in the header
41    bool IsJPEGBaseLineProcess1TransferSyntax(void);
42    bool IsJPEGExtendedProcess2_4TransferSyntax(void); 
43    bool IsJPEGExtendedProcess3_5TransferSyntax(void);
44    bool IsJPEGSpectralSelectionProcess6_8TransferSyntax(void); 
45    bool IsRLELossLessTransferSyntax(void); 
46    bool IsJPEGLossless(void); 
47    bool IsJPEG2000(void); 
48    bool IsDicomV3(void); 
49
50    // Some heuristic based accessors, end user intended 
51    // (to be move to gdcmHeaderHelper?) 
52    int GetXSize(void);  
53    int GetYSize(void);
54    int GetZSize(void);
55    int GetBitsStored(void);
56    int GetBitsAllocated(void);
57    int GetSamplesPerPixel(void);   
58    int GetPlanarConfiguration(void);
59
60    int GetPixelSize(void);   
61    std::string GetPixelType(void);  
62    size_t GetPixelOffset(void);
63    size_t GetPixelAreaLength(void);
64
65    bool   HasLUT(void);
66    int    GetLUTNbits(void);
67    unsigned char * GetLUTRGBA(void);
68
69    std::string GetTransfertSyntaxName(void);
70
71    // When some proprietary shadow groups are disclosed, we can set up
72    // an additional specific dictionary to access extra information.
73    
74    // OK : we still have *ONE* HeaderEntrySet, 
75    // with both Public and Shadow Elements
76    // parsed against THE Public Dictionary and A (single) Shadow Dictionary
77    
78    // TODO Swig int SetShaDict(std::string filename);
79    // TODO Swig int SetPubDict(std::string filename);
80
81 // Entry
82    inline virtual std::string GetEntryByName    (std::string tagName) 
83       { return(gdcmParser::GetEntryByName(tagName)); }
84    inline virtual std::string GetEntryVRByName  (std::string tagName)
85       { return(gdcmParser::GetEntryVRByName(tagName)); }
86    inline virtual std::string GetEntryByNumber  (guint16 group, guint16 element)
87       { return(gdcmParser::GetEntryByNumber(group,element)); }
88    inline virtual std::string GetEntryVRByNumber(guint16 group, guint16 element)
89       { return(gdcmParser::GetEntryVRByNumber(group,element)); }
90
91    inline virtual bool SetEntryByName(std::string content,std::string tagName)
92       { return(gdcmParser::SetEntryByName(content,tagName)); }
93    inline virtual bool SetEntryByNumber(std::string content,guint16 group, guint16 element)
94       { return(gdcmParser::SetEntryByNumber(content,group,element)); }
95
96
97 // Read (used in gdcmFile)
98    void SetImageDataSize(size_t ExpectedSize);
99
100 protected:
101    int write(std::ostream&);   
102    int anonymize(std::ostream&);  // FIXME : anonymize should be a friend ?
103
104 private:
105 };
106
107 //-----------------------------------------------------------------------------
108 #endif