1 /*=========================================================================
4 Module: $RCSfile: gdcmHeader.h,v $
6 Date: $Date: 2004/09/29 17:33:17 $
7 Version: $Revision: 1.88 $
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.
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.
17 =========================================================================*/
22 #include "gdcmCommon.h"
23 #include "gdcmDocument.h"
24 //-----------------------------------------------------------------------------
27 * The purpose of an instance of gdcmHeader is to act as a container of
28 * all the DICOM elements and their corresponding values (and
29 * additionaly the corresponding DICOM dictionary entry) of the header
32 * The typical usage of instances of class gdcmHeader is to classify a set of
33 * dicom files according to header information e.g. to create a file hierarchy
34 * reflecting the Patient/Study/Serie informations, or extracting a given
35 * SerieId. Accessing the content (image[s] or volume[s]) is beyond the
36 * functionality of this class and belongs to gdmcFile.
37 * \note The various entries of the explicit value representation (VR) shall
38 * be managed within a dictionary which is shared by all gdcmHeader
40 * \note The gdcmHeader::Set*Tag* family members cannot be defined as
41 * protected due to Swig limitations for as Has_a dependency between
42 * gdcmFile and gdcmHeader.
45 //-----------------------------------------------------------------------------
46 // Dicom Part 3.3 Compliant
51 BI, // Biomagnetic Imaging
52 CF, // Cinefluorography
54 CR, // Computed Radiography
56 CT, // Computed Tomography
58 DF, // Digital Fluoroscopy
60 DM, // Digital Microscopy
61 DS, // Digital Substraction Angiography
62 DX, // Digital Radiography
63 ECG, // Echocardiography
64 EPS, // Basic Cardiac EP
66 FA, // Fluorescein Angiography
71 LS, // Laser Surface Scan
72 MA, // Magnetic Resonance Angiography
73 MR, // Magnetic Resonance
74 NM, // Nuclear Medicine
76 PT, // Positron Emission Tomography
77 RF, // Radio Fluoroscopy
78 RG, // Radiographic Imaging
79 RTDOSE, // Radiotherapy Dose
80 RTIMAGE, // Radiotherapy Image
81 RTPLAN, // Radiotherapy Plan
82 RTSTRUCT, // Radiotherapy Structure Set
83 SM, // Microscopic Imaging
84 ST, // Single-photon Emission Computed Tomography
87 VF, // Videofluorography
88 XA, // X-Ray Angiography
89 XC // Photographic Imaging
91 //-----------------------------------------------------------------------------
93 class GDCM_EXPORT gdcmHeader : public gdcmDocument
96 /// \brief In some cases (e.g. for some ACR-NEMA images) the Header Entry Element
97 /// Number of the 'Pixel Element' is *not* found at 0x0010. In order to
98 /// make things easier the parser shall store the proper value in
99 /// NumPixel to provide a unique access facility. See also the constructor
100 /// \ref gdcmHeader::gdcmHeader
102 /// \brief In some cases (e.g. for some ACR-NEMA images) the header entry for
103 /// the group of pixels is *not* found at 0x7fe0. In order to
104 /// make things easier the parser shall store the proper value in
105 /// GrPixel to provide a unique access facility. See also the constructor
106 /// \ref gdcmHeader::gdcmHeader
111 gdcmHeader( std::string const & filename );
113 virtual ~gdcmHeader();
115 // Standard values and informations contained in the header
116 virtual bool IsReadable();
118 // Some heuristic based accessors, end user intended
120 int GetBitsAllocated();
121 int GetSamplesPerPixel();
122 int GetPlanarConfiguration();
124 int GetHighBitPosition();
125 bool IsSignedPixelData();
127 bool IsPaletteColor();
130 std::string GetPixelType();
131 size_t GetPixelOffset();
132 size_t GetPixelAreaLength();
134 //Some image informations needed for third package imaging library
142 //void GetSpacing(float &x, float &y, float &z);
144 // Useful for rescaling graylevel:
145 float GetRescaleIntercept();
146 float GetRescaleSlope();
148 int GetNumberOfScalarComponents();
149 int GetNumberOfScalarComponentsRaw();
151 int GetImageNumber();
152 ModalityType GetModality();
157 //void GetOrigin(float &x, float &y, float &z);
161 unsigned char * GetLUTRGBA();
163 std::string GetTransfertSyntaxName();
165 /// Accessor to \ref gdcmHeader::GrPixel
166 uint16_t GetGrPixel() { return GrPixel; }
168 /// Accessor to \ref gdcmHeader::NumPixel
169 uint16_t GetNumPixel() { return NumPixel; }
171 /// Read (used in gdcmFile)
172 void SetImageDataSize(size_t expectedSize);
174 void Write(FILE* fp, FileType filetype);
177 bool AnonymizeHeader();
178 void GetImageOrientationPatient( float iop[6] );
181 friend class gdcmSerieHeader;
184 //-----------------------------------------------------------------------------