1 /*=========================================================================
4 Module: $RCSfile: gdcmFile.h,v $
6 Date: $Date: 2005/07/24 02:14:43 $
7 Version: $Revision: 1.114 $
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"
37 typedef std::pair<double, double> Res;
40 class JPEGFragmentsInfo;
42 //-----------------------------------------------------------------------------
43 // Dicom Part 3.3 Compliant
48 BI, // Biomagnetic Imaging
49 CF, // Cinefluorography
51 CR, // Computed Radiography
53 CT, // Computed Tomography
55 DF, // Digital Fluoroscopy
57 DM, // Digital Microscopy
58 DS, // Digital Substraction Angiography
59 DX, // Digital Radiography
60 ECG, // Echocardiography
61 EPS, // Basic Cardiac EP
63 FA, // Fluorescein Angiography
68 LS, // Laser Surface Scan
69 MA, // Magnetic Resonance Angiography
70 MR, // Magnetic Resonance
71 NM, // Nuclear Medicine
73 PT, // Positron Emission Tomography
74 RF, // Radio Fluoroscopy
75 RG, // Radiographic Imaging
76 RTDOSE, // Radiotherapy Dose
77 RTIMAGE, // Radiotherapy Image
78 RTPLAN, // Radiotherapy Plan
79 RTSTRUCT, // Radiotherapy Structure Set
80 SM, // Microscopic Imaging
81 ST, // Single-photon Emission Computed Tomography
84 VF, // Videofluorography
85 XA, // X-Ray Angiography
86 XC // Photographic Imaging
89 //-----------------------------------------------------------------------------
92 * \brief DICOM elements and their corresponding values (and
93 * additionaly the corresponding DICOM dictionary entry) of the header
96 * The typical usage of instances of class File is to classify a set of
97 * dicom files according to header information e.g. to create a file hierarchy
98 * reflecting the Patient/Study/Serie informations, or extracting a given
99 * SerieId. Accessing the content (image[s] or volume[s]) is beyond the
100 * functionality of this class and belongs to gdcm::FileHelper.
101 * \note The various entries of the explicit value representation (VR) shall
102 * be managed within a dictionary which is shared by all File
104 * \note The File::Set*Tag* family members cannot be defined as
105 * protected due to Swig limitations for as Has_a dependency between
106 * File and FileHelper.
108 class GDCM_EXPORT File : public Document
112 GDCM_LEGACY(File( std::string const &filename ));
116 GDCM_LEGACY(bool Load( std::string const &filename ));
118 // Standard values and informations contained in the header
121 // Some heuristic based accessors, end user intended
122 int GetImageNumber();
123 ModalityType GetModality();
137 bool GetImageOrientationPatient( float iop[6] );
140 int GetBitsAllocated();
141 int GetHighBitPosition();
142 int GetSamplesPerPixel();
143 int GetPlanarConfiguration();
145 std::string GetPixelType();
146 bool IsSignedPixelData();
148 bool IsMonochrome1();
149 bool IsPaletteColor();
155 // For rescaling graylevel:
156 float GetRescaleIntercept();
157 float GetRescaleSlope();
159 int GetNumberOfScalarComponents();
160 int GetNumberOfScalarComponentsRaw();
162 /// Accessor to \ref File::GrPixel
163 uint16_t GetGrPixel() { return GrPixel; }
164 /// Accessor to \ref File::NumPixel
165 uint16_t GetNumPixel() { return NumPixel; }
167 size_t GetPixelOffset();
168 size_t GetPixelAreaLength();
170 /// returns the RLE info
171 RLEFramesInfo *GetRLEInfo() { return RLEInfo; }
172 /// Returns the JPEG Fragments info
173 JPEGFragmentsInfo *GetJPEGInfo() { return JPEGInfo; }
175 // Anonymization process
176 void AddAnonymizeElement (uint16_t group, uint16_t elem,
177 std::string const &value);
178 /// Clears the list of elements to be anonymized
179 void ClearAnonymizeList() { AnonymizeList.clear(); }
180 void AnonymizeNoLoad();
181 /// Replace patient's own information by info from the Anonymization list
182 bool AnonymizeFile();
184 bool Write(std::string fileName, FileType filetype);
186 double TypeOrientation( );
190 /// Store the RLE frames info obtained during parsing of pixels.
191 RLEFramesInfo *RLEInfo;
192 /// Store the JPEG fragments info obtained during parsing of pixels.
193 JPEGFragmentsInfo *JPEGInfo;
195 /// \brief In some cases (e.g. for some ACR-NEMA images) the Entry Element
196 /// Number of the 'Pixel Element' is *not* found at 0x0010. In order to
197 /// make things easier the parser shall store the proper value in
198 /// NumPixel to provide a unique access facility.
200 /// \brief In some cases (e.g. for some ACR-NEMA images) the header entry for
201 /// the group of pixels is *not* found at 0x7fe0.
202 /// In order to make things easier the parser shall store the proper value
203 /// in GrPixel to provide a unique access facility.
207 bool DoTheLoadingJob();
208 void ComputeRLEInfo();
209 void ComputeJPEGFragmentInfo();
210 bool ReadTag(uint16_t, uint16_t);
211 uint32_t ReadTagLength(uint16_t, uint16_t);
212 void ReadAndSkipEncapsulatedBasicOffsetTable();
214 Res VerfCriterion(int typeCriterion, double criterionNew, Res const & res);
215 double CalculLikelyhood2Vec(vector3D const & refA, vector3D const & refB,
216 vector3D const & ori1, vector3D const & ori2);
217 vector3D ProductVectorial(vector3D const & vec1, vector3D const & vec2);
219 } // end namespace gdcm
221 //-----------------------------------------------------------------------------