]> Creatis software - gdcm.git/blob - src/gdcmHeaderHelper.h
* gdcmHeader is now aggregating gdcmFile, and not derived into. Thus, we
[gdcm.git] / src / gdcmHeaderHelper.h
1 // $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.h,v 1.8 2003/12/22 12:46:16 regrain Exp $
2
3 #ifndef GDCMHEADERHELPER_H
4 #define GDCMHEADERHELPER_H
5
6 #include "gdcmHeader.h"
7
8    // Dicom Part 3.3 Compliant
9    enum ModalityType {
10       Unknow,
11       AU,       // Voice Audio
12       AS,       // Angioscopy
13       BI,       // Biomagnetic Imaging
14       CF,       // Cinefluorography
15       CP,       // Culposcopy
16       CR,       // Computed Radiography
17       CS,       // Cystoscopy
18       CT,       // Computed Tomography
19       DD,       // Duplex Dopler
20       DF,       // Digital Fluoroscopy
21       DG,       // Diaphanography
22       DM,       // Digital Microscopy
23       DS,       // Digital Substraction Angiography
24       DX,       // Digital Radiography
25       ECG,      // Echocardiography
26       EPS,      // Basic Cardiac EP
27       ES,       // Endoscopy
28       FA,       // Fluorescein Angiography
29       FS,       // Fundoscopy
30       HC,       // Hard Copy
31       HD,       // Hemodynamic
32       LP,       // Laparoscopy
33       LS,       // Laser Surface Scan
34       MA,       // Magnetic Resonance Angiography
35       MR,       // Magnetic Resonance
36       NM,       // Nuclear Medicine
37       OT,       // Other
38       PT,       // Positron Emission Tomography
39       RF,       // Radio Fluoroscopy
40       RG,       // Radiographic Imaging
41       RTDOSE,   // Radiotherapy Dose
42       RTIMAGE,  // Radiotherapy Image
43       RTPLAN,   // Radiotherapy Plan
44       RTSTRUCT, // Radiotherapy Structure Set
45       SM,       // Microscopic Imaging
46       ST,       // Single-photon Emission Computed Tomography
47       TG,       // Thermography
48       US,       // Ultrasound
49       VF,       // Videofluorography
50       XA,       // X-Ray Angiography
51       XC        // Photographic Imaging
52     };
53       
54 /**
55   This class is meant to *interpret* data given from gdcmHeader
56   That is to say :
57    * it will help other dev to link against there lib
58    * return value instead of string
59    * will be able to search for data at some other place
60    * return *default value* which is not a gdcmHeader goal
61    * ...
62 */
63 class GDCM_EXPORT gdcmHeaderHelper : public gdcmHeader {
64
65 public:
66    gdcmHeaderHelper::gdcmHeaderHelper();
67    gdcmHeaderHelper::gdcmHeaderHelper(const char *filename, bool exception_on_error = false);
68
69    int GetPixelSize();
70    std::string GetPixelType();
71    
72    float GetXSpacing();
73    float GetYSpacing();
74    float GetZSpacing();
75    
76    //Usefull for rescaling graylevel:
77    float GetRescaleIntercept();
78    float GetRescaleSlope();
79
80    int GetNumberOfScalarComponents();
81    int GetNumberOfScalarComponentsRaw();
82
83    std::string GetStudyUID();
84    std::string GetSeriesUID();
85    std::string GetClassUID();
86    std::string GetInstanceUID();
87    
88     /**
89     change GetXImagePosition -> GetXOrigin in order not to confused reader
90       -# GetXOrigin can return default value (=0) if it was not ImagePosition
91       -# Image Position is different in dicomV3 <> ACR NEMA -> better use generic
92       name
93     */
94    float GetXOrigin();
95    float GetYOrigin();
96    float GetZOrigin();
97    
98    int GetImageNumber();
99    ModalityType GetModality();
100    
101    void GetImageOrientationPatient( float* iop );
102   
103
104 };
105
106 /**
107 This class should be used for a stack of 2D dicom images.
108 For a multiframe dicom image better use directly gdcmHeaderHelper
109 */
110 class GDCM_EXPORT gdcmSerieHeaderHelper {
111
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    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