]> Creatis software - gdcm.git/blob - src/gdcmHeaderHelper.h
update the doxygen scripts to -try to (Mmmm?)- allow 'user doc' generation
[gdcm.git] / src / gdcmHeaderHelper.h
1 // gdcmHeaderHelper.h
2 //-----------------------------------------------------------------------------
3 #ifndef GDCMHEADERHELPER_H
4 #define GDCMHEADERHELPER_H
5
6 #include "gdcmHeader.h"
7
8 //-----------------------------------------------------------------------------
9 // Dicom Part 3.3 Compliant
10 enum ModalityType {
11    Unknow,
12    AU,       // Voice Audio
13    AS,       // Angioscopy
14    BI,       // Biomagnetic Imaging
15    CF,       // Cinefluorography
16    CP,       // Culposcopy
17    CR,       // Computed Radiography
18    CS,       // Cystoscopy
19    CT,       // Computed Tomography
20    DD,       // Duplex Dopler
21    DF,       // Digital Fluoroscopy
22    DG,       // Diaphanography
23    DM,       // Digital Microscopy
24    DS,       // Digital Substraction Angiography
25    DX,       // Digital Radiography
26    ECG,      // Echocardiography
27    EPS,      // Basic Cardiac EP
28    ES,       // Endoscopy
29    FA,       // Fluorescein Angiography
30    FS,       // Fundoscopy
31    HC,       // Hard Copy
32    HD,       // Hemodynamic
33    LP,       // Laparoscopy
34    LS,       // Laser Surface Scan
35    MA,       // Magnetic Resonance Angiography
36    MR,       // Magnetic Resonance
37    NM,       // Nuclear Medicine
38    OT,       // Other
39    PT,       // Positron Emission Tomography
40    RF,       // Radio Fluoroscopy
41    RG,       // Radiographic Imaging
42    RTDOSE,   // Radiotherapy Dose
43    RTIMAGE,  // Radiotherapy Image
44    RTPLAN,   // Radiotherapy Plan
45    RTSTRUCT, // Radiotherapy Structure Set
46    SM,       // Microscopic Imaging
47    ST,       // Single-photon Emission Computed Tomography
48    TG,       // Thermography
49    US,       // Ultrasound
50    VF,       // Videofluorography
51    XA,       // X-Ray Angiography
52    XC        // Photographic Imaging
53 };
54       
55 //-----------------------------------------------------------------------------
56 /*
57  * \defgroup gdcmHeaderHelper
58  * \brief  
59  *
60  * - This class is meant to *interpret* data given from gdcmHeader
61  * - That is to say :
62  *  - it will help other dev to link against there lib
63  *  - return value instead of string
64  *  - will be able to search for data at some other place
65  *  - return *default value* which is not a gdcmHeader goal
66  *  - ...
67  */
68 class GDCM_EXPORT gdcmHeaderHelper : public gdcmHeader {
69 public:
70    gdcmHeaderHelper();
71    gdcmHeaderHelper(const char *filename, 
72               bool  exception_on_error = false, 
73               bool  enable_sequences   = false,
74               bool  ignore_shadow      = false);
75
76    int GetPixelSize();
77    std::string GetPixelType();
78    
79    float GetXSpacing();
80    float GetYSpacing();
81    float GetZSpacing();
82    
83    // Usefull for rescaling graylevel:
84    float GetRescaleIntercept();
85    float GetRescaleSlope();
86
87    int GetNumberOfScalarComponents();
88    int GetNumberOfScalarComponentsRaw();
89
90    std::string GetStudyUID();
91    std::string GetSeriesUID();
92    std::string GetClassUID();
93    std::string GetInstanceUID();
94    
95    /**
96     * change GetXImagePosition -> GetXOrigin in order not to confuse reader
97     * -# GetXOrigin can return default value (=0) if it was not ImagePosition
98     * -# Image Position is different in dicomV3 <> ACR NEMA -> better use generic
99     * name
100    */
101    float GetXOrigin();
102    float GetYOrigin();
103    float GetZOrigin();
104    
105    int GetImageNumber();
106    ModalityType GetModality();
107    
108    void GetImageOrientationPatient( float* iop );
109 };
110
111 //-----------------------------------------------------------------------------
112 /*
113  * \defgroup gdcmSerieHeaderHelper
114  * \brief  
115  *
116  * - This class should be used for a stack of 2D dicom images.
117  * - For a multiframe dicom image better use directly gdcmHeaderHelper
118 */
119 class GDCM_EXPORT gdcmSerieHeaderHelper {
120 public:
121     gdcmSerieHeaderHelper() {};
122     ~gdcmSerieHeaderHelper();
123
124    void AddFileName(std::string filename); //should return bool or throw error ?
125    void AddGdcmFile(gdcmHeaderHelper *file);
126    void SetDirectory(std::string dir);
127    void OrderGdcmFileList();
128    
129    inline gdcmHeaderHelper *GetGdcmHeader()
130    {
131       //Assume all element in the list have the same global infos
132       return CoherentGdcmFileList.front();
133    }
134    
135    std::list<gdcmHeaderHelper*>& GetGdcmFileList();
136
137 private:
138    bool ImagePositionPatientOrdering();
139    bool ImageNumberOrdering();
140    bool FileNameOrdering();
141    
142    std::list<gdcmHeaderHelper*> CoherentGdcmFileList;
143 };
144
145 //-----------------------------------------------------------------------------
146 #endif