]> Creatis software - gdcm.git/blob - src/gdcmFile.h
Some normalizations :
[gdcm.git] / src / gdcmFile.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmFile.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/23 10:12:34 $
7   Version:   $Revision: 1.99 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #ifndef GDCMFILE_H
20 #define GDCMFILE_H
21
22 #include "gdcmDocument.h"
23
24 namespace gdcm 
25 {
26
27 //-----------------------------------------------------------------------------
28 // Dicom Part 3.3 Compliant
29 enum ModalityType {
30    Unknow,
31    AU,       // Voice Audio
32    AS,       // Angioscopy
33    BI,       // Biomagnetic Imaging
34    CF,       // Cinefluorography
35    CP,       // Culposcopy
36    CR,       // Computed Radiography
37    CS,       // Cystoscopy
38    CT,       // Computed Tomography
39    DD,       // Duplex Dopler
40    DF,       // Digital Fluoroscopy
41    DG,       // Diaphanography
42    DM,       // Digital Microscopy
43    DS,       // Digital Substraction Angiography
44    DX,       // Digital Radiography
45    ECG,      // Echocardiography
46    EPS,      // Basic Cardiac EP
47    ES,       // Endoscopy
48    FA,       // Fluorescein Angiography
49    FS,       // Fundoscopy
50    HC,       // Hard Copy
51    HD,       // Hemodynamic
52    LP,       // Laparoscopy
53    LS,       // Laser Surface Scan
54    MA,       // Magnetic Resonance Angiography
55    MR,       // Magnetic Resonance
56    NM,       // Nuclear Medicine
57    OT,       // Other
58    PT,       // Positron Emission Tomography
59    RF,       // Radio Fluoroscopy
60    RG,       // Radiographic Imaging
61    RTDOSE,   // Radiotherapy Dose
62    RTIMAGE,  // Radiotherapy Image
63    RTPLAN,   // Radiotherapy Plan
64    RTSTRUCT, // Radiotherapy Structure Set
65    SM,       // Microscopic Imaging
66    ST,       // Single-photon Emission Computed Tomography
67    TG,       // Thermography
68    US,       // Ultrasound
69    VF,       // Videofluorography
70    XA,       // X-Ray Angiography
71    XC        // Photographic Imaging
72 };
73
74 //-----------------------------------------------------------------------------
75 /**
76  * \brief DICOM elements and their corresponding values (and
77  * additionaly the corresponding DICOM dictionary entry) of the header
78  * of a DICOM file.
79  *
80  * The typical usage of instances of class File is to classify a set of
81  * dicom files according to header information e.g. to create a file hierarchy
82  * reflecting the Patient/Study/Serie informations, or extracting a given
83  * SerieId. Accessing the content (image[s] or volume[s]) is beyond the
84  * functionality of this class and belongs to gdmcFile.
85  * \note  The various entries of the explicit value representation (VR) shall
86  *        be managed within a dictionary which is shared by all File
87  *        instances.
88  * \note  The File::Set*Tag* family members cannot be defined as
89  *        protected due to Swig limitations for as Has_a dependency between
90  *        File and FileHelper.
91  */
92
93 //-----------------------------------------------------------------------------
94
95 class GDCM_EXPORT File : public Document
96 {
97 protected:
98    /// \brief In some cases (e.g. for some ACR-NEMA images) the Entry Element
99    /// Number of the 'Pixel Element' is *not* found at 0x0010. In order to
100    /// make things easier the parser shall store the proper value in
101    /// NumPixel to provide a unique access facility. 
102    uint16_t NumPixel;
103    /// \brief In some cases (e.g. for some ACR-NEMA images) the header entry for
104    /// the group of pixels is *not* found at 0x7fe0. In order to
105    /// make things easier the parser shall store the proper value in
106    /// GrPixel to provide a unique access facility.
107    uint16_t GrPixel;
108
109 public:
110    File();
111    File( std::string const &filename );
112  
113    ~File();
114
115    // Standard values and informations contained in the header
116    bool IsReadable();
117
118    // Some heuristic based accessors, end user intended 
119    int GetBitsStored();
120    int GetBitsAllocated();
121    int GetSamplesPerPixel();
122    int GetPlanarConfiguration();
123    int GetPixelSize();
124    int GetHighBitPosition();
125    bool IsSignedPixelData();
126    bool IsMonochrome();
127    bool IsPaletteColor();
128    bool IsYBRFull();
129
130    std::string GetPixelType();
131    size_t GetPixelOffset();
132    size_t GetPixelAreaLength();
133
134    //Some image informations needed for third package imaging library
135    int GetXSize();
136    int GetYSize();
137    int GetZSize();
138
139    float GetXSpacing();
140    float GetYSpacing();
141    float GetZSpacing();
142
143    // For rescaling graylevel:
144    float GetRescaleIntercept();
145    float GetRescaleSlope();
146
147    int GetNumberOfScalarComponents();
148    int GetNumberOfScalarComponentsRaw();
149
150    // To organize DICOM files based on their x,y,z position 
151    void GetImageOrientationPatient( float iop[6] );
152
153    int GetImageNumber();
154    ModalityType GetModality();
155
156    float GetXOrigin();
157    float GetYOrigin();
158    float GetZOrigin();
159
160    bool   HasLUT();
161    int    GetLUTNbits();
162
163    /// Accessor to \ref File::GrPixel
164    uint16_t GetGrPixel()  { return GrPixel; }
165    
166    /// Accessor to \ref File::NumPixel
167    uint16_t GetNumPixel() { return NumPixel; }
168
169    bool Write(std::string fileName, FileType filetype);
170
171    /// Initialize DICOM File when none
172    void InitializeDefaultFile();
173  
174 protected:
175    /// Replace patient's specific information by 'anonymous'
176    bool AnonymizeFile();
177
178 private:
179
180 };
181 } // end namespace gdcm
182
183 //-----------------------------------------------------------------------------
184 #endif