1 /*=========================================================================
4 Module: $RCSfile: gdcmFile.h,v $
6 Date: $Date: 2005/07/19 15:19:26 $
7 Version: $Revision: 1.110 $
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 "gdcmDebug.h"
23 #include "gdcmDocument.h"
28 class JPEGFragmentsInfo;
30 //-----------------------------------------------------------------------------
31 // Dicom Part 3.3 Compliant
36 BI, // Biomagnetic Imaging
37 CF, // Cinefluorography
39 CR, // Computed Radiography
41 CT, // Computed Tomography
43 DF, // Digital Fluoroscopy
45 DM, // Digital Microscopy
46 DS, // Digital Substraction Angiography
47 DX, // Digital Radiography
48 ECG, // Echocardiography
49 EPS, // Basic Cardiac EP
51 FA, // Fluorescein Angiography
56 LS, // Laser Surface Scan
57 MA, // Magnetic Resonance Angiography
58 MR, // Magnetic Resonance
59 NM, // Nuclear Medicine
61 PT, // Positron Emission Tomography
62 RF, // Radio Fluoroscopy
63 RG, // Radiographic Imaging
64 RTDOSE, // Radiotherapy Dose
65 RTIMAGE, // Radiotherapy Image
66 RTPLAN, // Radiotherapy Plan
67 RTSTRUCT, // Radiotherapy Structure Set
68 SM, // Microscopic Imaging
69 ST, // Single-photon Emission Computed Tomography
72 VF, // Videofluorography
73 XA, // X-Ray Angiography
74 XC // Photographic Imaging
77 //-----------------------------------------------------------------------------
80 * \brief DICOM elements and their corresponding values (and
81 * additionaly the corresponding DICOM dictionary entry) of the header
84 * The typical usage of instances of class File is to classify a set of
85 * dicom files according to header information e.g. to create a file hierarchy
86 * reflecting the Patient/Study/Serie informations, or extracting a given
87 * SerieId. Accessing the content (image[s] or volume[s]) is beyond the
88 * functionality of this class and belongs to gdmcFile.
89 * \note The various entries of the explicit value representation (VR) shall
90 * be managed within a dictionary which is shared by all File
92 * \note The File::Set*Tag* family members cannot be defined as
93 * protected due to Swig limitations for as Has_a dependency between
94 * File and FileHelper.
96 class GDCM_EXPORT File : public Document
100 GDCM_LEGACY(File( std::string const &filename ));
104 GDCM_LEGACY(bool Load( std::string const &filename ));
106 // Standard values and informations contained in the header
109 // Some heuristic based accessors, end user intended
110 int GetImageNumber();
111 ModalityType GetModality();
125 void GetImageOrientationPatient( float iop[6] );
128 int GetBitsAllocated();
129 int GetHighBitPosition();
130 int GetSamplesPerPixel();
131 int GetPlanarConfiguration();
133 std::string GetPixelType();
134 bool IsSignedPixelData();
136 bool IsMonochrome1();
137 bool IsPaletteColor();
143 // For rescaling graylevel:
144 float GetRescaleIntercept();
145 float GetRescaleSlope();
147 int GetNumberOfScalarComponents();
148 int GetNumberOfScalarComponentsRaw();
150 /// Accessor to \ref File::GrPixel
151 uint16_t GetGrPixel() { return GrPixel; }
152 /// Accessor to \ref File::NumPixel
153 uint16_t GetNumPixel() { return NumPixel; }
155 size_t GetPixelOffset();
156 size_t GetPixelAreaLength();
158 /// returns the RLE info
159 RLEFramesInfo *GetRLEInfo() { return RLEInfo; }
160 /// Returns the JPEG Fragments info
161 JPEGFragmentsInfo *GetJPEGInfo() { return JPEGInfo; }
163 // Anonymization process
164 void AddAnonymizeElement (uint16_t group, uint16_t elem,
165 std::string const &value);
166 /// Clears the list of elements to be anonymized
167 void ClearAnonymizeList() { AnonymizeList.clear(); }
168 void AnonymizeNoLoad();
169 /// Replace patient's own information by info from the Anonymization list
170 bool AnonymizeFile();
172 bool Write(std::string fileName, FileType filetype);
176 /// Store the RLE frames info obtained during parsing of pixels.
177 RLEFramesInfo *RLEInfo;
178 /// Store the JPEG fragments info obtained during parsing of pixels.
179 JPEGFragmentsInfo *JPEGInfo;
181 /// \brief In some cases (e.g. for some ACR-NEMA images) the Entry Element
182 /// Number of the 'Pixel Element' is *not* found at 0x0010. In order to
183 /// make things easier the parser shall store the proper value in
184 /// NumPixel to provide a unique access facility.
186 /// \brief In some cases (e.g. for some ACR-NEMA images) the header entry for
187 /// the group of pixels is *not* found at 0x7fe0.
188 /// In order to make things easier the parser shall store the proper value
189 /// in GrPixel to provide a unique access facility.
193 bool DoTheLoadingJob();
194 void ComputeRLEInfo();
195 void ComputeJPEGFragmentInfo();
196 bool ReadTag(uint16_t, uint16_t);
197 uint32_t ReadTagLength(uint16_t, uint16_t);
198 void ReadAndSkipEncapsulatedBasicOffsetTable();
201 } // end namespace gdcm
203 //-----------------------------------------------------------------------------