]> Creatis software - gdcm.git/blob - src/gdcmHeaderHelper.h
2003-11-03 Jean-Pierre Roux
[gdcm.git] / src / gdcmHeaderHelper.h
1 // $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.h,v 1.5 2003/11/03 10:49:31 jpr Exp $
2
3 #ifndef GDCMHEADERHELPER_H
4 #define GDCMHEADERHELPER_H
5
6 #include "gdcmHeader.h"
7 #include <list>
8 #include <string>
9 #include <vector>
10
11    // Dicom Part 3.3 Compliant
12    enum ModalityType {
13       Unknow,
14       AU,       // Voice Audio
15       AS,       // Angioscopy
16       BI,       // Biomagnetic Imaging
17       CF,       // Cinefluorography
18       CP,       // Culposcopy
19       CR,       // Computed Radiography
20       CS,       // Cystoscopy
21       CT,       // Computed Tomography
22       DD,       // Duplex Dopler
23       DF,       // Digital Fluoroscopy
24       DG,       // Diaphanography
25       DM,       // Digital Microscopy
26       DS,       // Digital Substraction Angiography
27       DX,       // Digital Radiography
28       ECG,      // Echocardiography
29       EPS,      // Basic Cardiac EP
30       ES,       // Endoscopy
31       FA,       // Fluorescein Angiography
32       FS,       // Fundoscopy
33       HC,       // Hard Copy
34       HD,       // Hemodynamic
35       LP,       // Laparoscopy
36       LS,       // Laser Surface Scan
37       MA,       // Magnetic Resonance Angiography
38       MR,       // Magnetic Resonance
39       NM,       // Nuclear Medicine
40       OT,       // Other
41       PT,       // Positron Emission Tomography
42       RF,       // Radio Fluoroscopy
43       RG,       // Radiographic Imaging
44       RTDOSE,   // Radiotherapy Dose
45       RTIMAGE,  // Radiotherapy Image
46       RTPLAN,   // Radiotherapy Plan
47       RTSTRUCT, // Radiotherapy Structure Set
48       SM,       // Microscopic Imaging
49       ST,       // Single-photon Emission Computed Tomography
50       TG,       // Thermography
51       US,       // Ultrasound
52       VF,       // Videofluorography
53       XA,       // X-Ray Angiography
54       XC        // Photographic Imaging
55     };
56       
57 /**
58   This class is meant to *interpret* data given from gdcmHeader
59   That is to say :
60    * it will help other dev to link against there lib
61    * return value instead of string
62    * will be able to search for data at some other place
63    * return *default value* which is not a gdcmHeader goal
64    * ...
65 */
66 class GDCM_EXPORT gdcmHeaderHelper : public gdcmHeader {
67
68 public:
69
70    gdcmHeaderHelper::gdcmHeaderHelper();
71    gdcmHeaderHelper::gdcmHeaderHelper(const char *filename, bool exception_on_error = false);
72
73    int GetPixelSize();
74    std::string GetPixelType();
75    
76    float GetXSpacing();
77    float GetYSpacing();
78    float GetZSpacing();
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