]> Creatis software - gdcm.git/blob - src/gdcmHeaderHelper.h
8f44170724c5a2550b4627f4a5f72e842148c670
[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  * This class is meant to *interpret* data given from gdcmHeader
58  * That is to say :
59  *  - it will help other dev to link against there lib
60  *  - return value instead of string
61  *  - will be able to search for data at some other place
62  *  - return *default value* which is not a gdcmHeader goal
63  *  - ...
64  */
65 class GDCM_EXPORT gdcmHeaderHelper : public gdcmHeader {
66 public:
67    gdcmHeaderHelper::gdcmHeaderHelper();
68    gdcmHeaderHelper::gdcmHeaderHelper(const char *filename, 
69                                       bool exception_on_error = false);
70
71    int GetPixelSize();
72    std::string GetPixelType();
73    
74    float GetXSpacing();
75    float GetYSpacing();
76    float GetZSpacing();
77    
78    // Usefull for rescaling graylevel:
79    float GetRescaleIntercept();
80    float GetRescaleSlope();
81
82    int GetNumberOfScalarComponents();
83    int GetNumberOfScalarComponentsRaw();
84
85    std::string GetStudyUID();
86    std::string GetSeriesUID();
87    std::string GetClassUID();
88    std::string GetInstanceUID();
89    
90    /**
91     * change GetXImagePosition -> GetXOrigin in order not to confused reader
92     * -# GetXOrigin can return default value (=0) if it was not ImagePosition
93     * -# Image Position is different in dicomV3 <> ACR NEMA -> better use generic
94     * name
95    */
96    float GetXOrigin();
97    float GetYOrigin();
98    float GetZOrigin();
99    
100    int GetImageNumber();
101    ModalityType GetModality();
102    
103    void GetImageOrientationPatient( float* iop );
104 };
105
106 //-----------------------------------------------------------------------------
107 /**
108 This class should be used for a stack of 2D dicom images.
109 For a multiframe dicom image better use directly gdcmHeaderHelper
110 */
111 class GDCM_EXPORT gdcmSerieHeaderHelper {
112 public:
113     gdcmSerieHeaderHelper::gdcmSerieHeaderHelper() {};
114     gdcmSerieHeaderHelper::~gdcmSerieHeaderHelper();
115
116    void AddFileName(std::string filename); //should return bool or throw error ?
117    void AddGdcmFile(gdcmHeaderHelper *file);
118    void SetDirectory(std::string dir);
119    void OrderGdcmFileList();
120    
121    inline gdcmHeaderHelper *GetGdcmHeader()
122    {
123       //Assume all element in the list have the same global infos
124       return CoherentGdcmFileList.front();
125    }
126    
127    std::list<gdcmHeaderHelper*>& GetGdcmFileList();
128
129 private:
130    bool ImagePositionPatientOrdering();
131    bool ImageNumberOrdering();
132    bool FileNameOrdering();
133    
134    std::list<gdcmHeaderHelper*> CoherentGdcmFileList;
135 };
136
137 //-----------------------------------------------------------------------------
138 #endif