core/vil/file_formats/vil_dicom_header.h
Go to the documentation of this file.
00001 #ifndef vil_dicom_header_h_
00002 #define vil_dicom_header_h_
00003 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00004 #pragma interface
00005 #endif
00006 //:
00007 // \file
00008 // \brief DICOM Header reader and writer.
00009 // \author Chris Wolstenholme - Manchester
00010 // Modified by Ian Scott to work with vil loader.
00011 
00012 #include <vcl_ostream.h>
00013 #include <vcl_string.h>
00014 #include <vxl_config.h>
00015 #include <vil/vil_stream.h>
00016 #include <vcl_vector.h>
00017 
00018 //: DICOM types
00019 //  Defines the type of the dicom file being loaded. A
00020 //  dicom file can be a Part10 file a non-Part10 file or an unknown
00021 //  file type (possibly not dicom)
00022 
00023 enum vil_dicom_header_type
00024 {
00025   VIL_DICOM_HEADER_DTUNKNOWN=0, /*!< Value for unknown dicom types */
00026   VIL_DICOM_HEADER_DTPART10,    /*!< Value for Part10 dicom files */
00027   VIL_DICOM_HEADER_DTNON_PART10 /*!< Value for non Part10 dicom files */
00028 };
00029 
00030 //: Endian types
00031 enum vil_dicom_header_endian
00032 {
00033   VIL_DICOM_HEADER_DEUNKNOWN=0,    /*!< If the endian is unknown */
00034   VIL_DICOM_HEADER_DELITTLEENDIAN, /*!< Value for little endian */
00035   VIL_DICOM_HEADER_DEBIGENDIAN     /*!< Value for big endian */
00036 };
00037 
00038 //: Encapsulated image types
00039 enum vil_dicom_header_image_type
00040 {
00041   VIL_DICOM_HEADER_DITUNKNOWN=0,     /*!< Value for unknown (or non-encapsulated) file types */
00042   VIL_DICOM_HEADER_DITJPEGBASE,      /*!< Value for encapsulated jpeg baseline files */
00043   VIL_DICOM_HEADER_DITJPEGEXTLOSSY,  /*!< Value for encapsulated jpeg, extended lossy files */
00044   VIL_DICOM_HEADER_DITJPEGSPECNH,    /*!< Value for encapsulated jpeg, spectral selection non-hierarchical files */
00045   VIL_DICOM_HEADER_DITJPEGFULLNH,    /*!< Value for encapsulated jpeg, full progression non-hierarchical files */
00046   VIL_DICOM_HEADER_DITJPEGLOSSLNH,   /*!< Value for encapsulated jpeg, lossless non-hierarchical files */
00047   VIL_DICOM_HEADER_DITJPEGEXTHIER,   /*!< Value for encapsulated jpeg, extended hierarchical files */
00048   VIL_DICOM_HEADER_DITJPEGSPECHIER,  /*!< Value for encapsulated jpeg, spectral selection, hierarchical files */
00049   VIL_DICOM_HEADER_DITJPEGFULLHIER,  /*!< Value for encapsulated jpeg, full progression, hierarchical files */
00050   VIL_DICOM_HEADER_DITJPEGLOSSLHIER, /*!< Value for encapsulated jpeg, lossless, hierarchical files */
00051   VIL_DICOM_HEADER_DITJPEGLOSSLDEF,  /*!< Value for encapsulated jpeg, default lossless files */
00052   VIL_DICOM_HEADER_DITRLE            /*!< Value for encapsulated RLE files */
00053 };
00054 
00055 // Max size (number of groups/elements)
00056 const unsigned VIL_DICOM_HEADER_MAXHEADERSIZE             =100;
00057 
00058 // Define the dicom groups
00059 const vxl_uint_16 VIL_DICOM_HEADER_COMMANDGROUP             =0x0000;
00060 const vxl_uint_16 VIL_DICOM_HEADER_METAFILEGROUP            =0x0002;
00061 const vxl_uint_16 VIL_DICOM_HEADER_BASICDIRGROUP            =0x0004;
00062 const vxl_uint_16 VIL_DICOM_HEADER_IDENTIFYINGGROUP         =0x0008;
00063 const vxl_uint_16 VIL_DICOM_HEADER_PATIENTINFOGROUP         =0x0010;
00064 const vxl_uint_16 VIL_DICOM_HEADER_ACQUISITIONGROUP         =0x0018;
00065 const vxl_uint_16 VIL_DICOM_HEADER_RELATIONSHIPGROUP        =0x0020;
00066 const vxl_uint_16 VIL_DICOM_HEADER_IMAGEGROUP               =0x0028;
00067 const vxl_uint_16 VIL_DICOM_HEADER_STUDYGROUP               =0x0032;
00068 const vxl_uint_16 VIL_DICOM_HEADER_VISITGROUP               =0x0038;
00069 const vxl_uint_16 VIL_DICOM_HEADER_WAVEFORMGROUP            =0x003a;
00070 const vxl_uint_16 VIL_DICOM_HEADER_PROCEDUREGROUP           =0x0040;
00071 const vxl_uint_16 VIL_DICOM_HEADER_DEVICEGROUP              =0x0050;
00072 const vxl_uint_16 VIL_DICOM_HEADER_NMIMAGEGROUP             =0x0054;
00073 const vxl_uint_16 VIL_DICOM_HEADER_MEDIAGROUP               =0x0088;
00074 const vxl_uint_16 VIL_DICOM_HEADER_BASICFILMSESSIONGROUP    =0x2000;
00075 const vxl_uint_16 VIL_DICOM_HEADER_BASICFILMBOXGROUP        =0x2010;
00076 const vxl_uint_16 VIL_DICOM_HEADER_BASICIMAGEBOXGROUP       =0x2020;
00077 const vxl_uint_16 VIL_DICOM_HEADER_BASICANNOTATIONBOXGROUP  =0x2030;
00078 const vxl_uint_16 VIL_DICOM_HEADER_BASICIMAGEOVERLAYBOXGROUP=0x2040;
00079 const vxl_uint_16 VIL_DICOM_HEADER_PRINTJOBGROUP            =0x2100;
00080 const vxl_uint_16 VIL_DICOM_HEADER_PRINTERGROUP             =0x2110;
00081 const vxl_uint_16 VIL_DICOM_HEADER_TEXTGROUP                =0x4000;
00082 const vxl_uint_16 VIL_DICOM_HEADER_RESULTSGROUP             =0x4008;
00083 const vxl_uint_16 VIL_DICOM_HEADER_CURVEGROUP               =0x5000;
00084 const vxl_uint_16 VIL_DICOM_HEADER_OVERLAYGROUP             =0x6000;
00085 const vxl_uint_16 VIL_DICOM_HEADER_PIXELGROUP               =0x7fe0;
00086 const vxl_uint_16 VIL_DICOM_HEADER_PADGROUP                 =0xfffc;
00087 const vxl_uint_16 VIL_DICOM_HEADER_DELIMITERGROUP           =0xfffe;
00088 
00089 // Useful elements of the Meta File group
00090 const vxl_uint_16 VIL_DICOM_HEADER_MFGROUPLENGTH            =0x0000;
00091 const vxl_uint_16 VIL_DICOM_HEADER_MFTRANSFERSYNTAX         =0x0010;
00092 
00093 // Useful elements of the Identifying group
00094 const vxl_uint_16 VIL_DICOM_HEADER_IDGROUPLENGTH            =0x0000; // UL
00095 const vxl_uint_16 VIL_DICOM_HEADER_IDLENGTHTOEND            =0x0001; // RET
00096 const vxl_uint_16 VIL_DICOM_HEADER_IDSPECIFICCHARACTER      =0x0005; // CS
00097 const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGETYPE              =0x0008; // CS
00098 const vxl_uint_16 VIL_DICOM_HEADER_IDSOPCLASSID             =0x0016; // UI
00099 const vxl_uint_16 VIL_DICOM_HEADER_IDSOPINSTANCEID          =0x0018; // UI
00100 const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYDATE              =0x0020; // DA
00101 const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESDATE             =0x0021; // DA
00102 const vxl_uint_16 VIL_DICOM_HEADER_IDACQUISITIONDATE        =0x0022; // DA
00103 const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGEDATE              =0x0023; // DA
00104 const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYTIME              =0x0030; // TM
00105 const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESTIME             =0x0031; // TM
00106 const vxl_uint_16 VIL_DICOM_HEADER_IDACQUISITIONTIME        =0x0032; // TM
00107 const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGETIME              =0x0033; // TM
00108 const vxl_uint_16 VIL_DICOM_HEADER_IDACCESSIONNUMBER        =0x0050; // SH
00109 const vxl_uint_16 VIL_DICOM_HEADER_IDMODALITY               =0x0060; // CS
00110 const vxl_uint_16 VIL_DICOM_HEADER_IDMANUFACTURER           =0x0070; // LO
00111 const vxl_uint_16 VIL_DICOM_HEADER_IDINSTITUTIONNAME        =0x0080; // LO
00112 const vxl_uint_16 VIL_DICOM_HEADER_IDINSTITUTIONADDRESS     =0x0081; // ST
00113 const vxl_uint_16 VIL_DICOM_HEADER_IDREFERRINGPHYSICIAN     =0x0090; // PN
00114 const vxl_uint_16 VIL_DICOM_HEADER_IDSTATIONNAME            =0x1010; // SH
00115 const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYDESCRIPTION       =0x1030; // LO
00116 const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESDESCRIPTION      =0x103E; // LO
00117 const vxl_uint_16 VIL_DICOM_HEADER_IDATTENDINGPHYSICIAN     =0x1050; // PN
00118 const vxl_uint_16 VIL_DICOM_HEADER_IDOPERATORNAME           =0x1070; // PN
00119 const vxl_uint_16 VIL_DICOM_HEADER_IDMANUFACTURERMODEL      =0x1090; // LO
00120 
00121 // Useful elements from the Patient Info group
00122 const vxl_uint_16 VIL_DICOM_HEADER_PIGROUPLENGTH            =0x0000; // UL
00123 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTNAME            =0x0010; // PN
00124 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTID              =0x0020; // LO
00125 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTBIRTHDATE       =0x0030; // DA
00126 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTSEX             =0x0040; // CS
00127 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTAGE             =0x1010; // AS
00128 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTWEIGHT          =0x1030; // DS
00129 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTHISTORY         =0x21B0; // LT
00130 
00131 // Useful elements from the Acquisition group
00132 const vxl_uint_16 VIL_DICOM_HEADER_AQSCANNINGSEQUENCE       =0x0020; // CS
00133 const vxl_uint_16 VIL_DICOM_HEADER_AQSEQUENCEVARIANT        =0x0021; // CS
00134 const vxl_uint_16 VIL_DICOM_HEADER_AQSCANOPTIONS            =0x0022; // CS
00135 const vxl_uint_16 VIL_DICOM_HEADER_AQMRACQUISITIONTYPE      =0x0023; // CS
00136 const vxl_uint_16 VIL_DICOM_HEADER_AQSEQUENCENAME           =0x0024; // SH
00137 const vxl_uint_16 VIL_DICOM_HEADER_AQANGIOFLAG              =0x0025; // CS
00138 const vxl_uint_16 VIL_DICOM_HEADER_AQSLICETHICKNESS         =0x0050; // DS
00139 const vxl_uint_16 VIL_DICOM_HEADER_AQREPETITIONTIME         =0x0080; // DS
00140 const vxl_uint_16 VIL_DICOM_HEADER_AQECHOTIME               =0x0081; // DS
00141 const vxl_uint_16 VIL_DICOM_HEADER_AQINVERSIONTIME          =0x0082; // DS
00142 const vxl_uint_16 VIL_DICOM_HEADER_AQNUMBEROFAVERAGES       =0x0083; // DS
00143 const vxl_uint_16 VIL_DICOM_HEADER_AQECHONUMBERS            =0x0086; // IS
00144 const vxl_uint_16 VIL_DICOM_HEADER_AQMAGNETICFIELDSTRENGTH  =0x0087; // DS
00145 const vxl_uint_16 VIL_DICOM_HEADER_AQSLICESPACING           =0x0088; // DS
00146 const vxl_uint_16 VIL_DICOM_HEADER_AQECHOTRAINLENGTH        =0x0091; // IS
00147 const vxl_uint_16 VIL_DICOM_HEADER_AQPIXELBANDWIDTH         =0x0095; // DS
00148 const vxl_uint_16 VIL_DICOM_HEADER_AQSOFTWAREVERSION        =0x1020; // LO
00149 const vxl_uint_16 VIL_DICOM_HEADER_AQPROTOCOLNAME           =0x1030; // LO
00150 const vxl_uint_16 VIL_DICOM_HEADER_AQHEARTRATE              =0x1088; // IS
00151 const vxl_uint_16 VIL_DICOM_HEADER_AQCARDIACNUMBEROFIMAGES  =0x1090; // IS
00152 const vxl_uint_16 VIL_DICOM_HEADER_AQTRIGGERWINDOW          =0x1094; // IS
00153 const vxl_uint_16 VIL_DICOM_HEADER_AQRECONTRUCTIONDIAMETER  =0x1100; // DS
00154 const vxl_uint_16 VIL_DICOM_HEADER_AQRECEIVINGCOIL          =0x1250; // SH
00155 const vxl_uint_16 VIL_DICOM_HEADER_AQPHASEENCODINGDIRECTION =0x1312; // CS
00156 const vxl_uint_16 VIL_DICOM_HEADER_AQFLIPANGLE              =0x1314; // DS
00157 const vxl_uint_16 VIL_DICOM_HEADER_AQSAR                    =0x1316; // DS
00158 const vxl_uint_16 VIL_DICOM_HEADER_AQPATIENTPOSITION        =0x5100; // CS
00159 
00160 // Useful elements from the Relationship group
00161 const vxl_uint_16 VIL_DICOM_HEADER_RSSTUDYINSTANCEUID       =0x000D; // UI
00162 const vxl_uint_16 VIL_DICOM_HEADER_RSSERIESINSTANCEUID      =0x000E; // UI
00163 const vxl_uint_16 VIL_DICOM_HEADER_RSSTUDYID                =0x0010; // SH
00164 const vxl_uint_16 VIL_DICOM_HEADER_RSSERIESNUMBER           =0x0011; // IS
00165 const vxl_uint_16 VIL_DICOM_HEADER_RSAQUISITIONNUMBER       =0x0012; // IS
00166 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGENUMBER            =0x0013; // IS
00167 const vxl_uint_16 VIL_DICOM_HEADER_RSPATIENTORIENTATION     =0x0020; // CS
00168 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGEPOSITION          =0x0032; // DS
00169 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGEORIENTATION       =0x0037; // DS
00170 const vxl_uint_16 VIL_DICOM_HEADER_RSFRAMEOFREFERENCEUID    =0x0052; // UI
00171 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGESINACQUISITION    =0x1002; // IS
00172 const vxl_uint_16 VIL_DICOM_HEADER_RSPOSITIONREFERENCE      =0x1040; // LO
00173 const vxl_uint_16 VIL_DICOM_HEADER_RSSLICELOCATION          =0x1041; // DS
00174 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGECOMMENTS          =0x4000; // LT
00175 
00176 // Useful elements from the Image group
00177 const vxl_uint_16 VIL_DICOM_HEADER_IMSAMPLESPERPIXEL        =0x0002; // US
00178 const vxl_uint_16 VIL_DICOM_HEADER_IMPHOTOMETRICINTERP      =0x0004; // CS
00179 const vxl_uint_16 VIL_DICOM_HEADER_IMROWS                   =0x0010; // US
00180 const vxl_uint_16 VIL_DICOM_HEADER_IMCOLUMNS                =0x0011; // US
00181 const vxl_uint_16 VIL_DICOM_HEADER_IMPLANES                 =0x0012; // US
00182 const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELSPACING           =0x0030; // DS
00183 const vxl_uint_16 VIL_DICOM_HEADER_IMBITSALLOCATED          =0x0100; // US
00184 const vxl_uint_16 VIL_DICOM_HEADER_IMBITSSTORED             =0x0101; // US
00185 const vxl_uint_16 VIL_DICOM_HEADER_IMHIGHBIT                =0x0102; // US
00186 const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELREPRESENTATION    =0x0103; // US
00187 const vxl_uint_16 VIL_DICOM_HEADER_IMSMALLIMPIXELVALUE      =0x0106; // US
00188 const vxl_uint_16 VIL_DICOM_HEADER_IMLARGEIMPIXELVALUE      =0x0107; // US
00189 const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELPADDINGVALUE      =0x0120; // US
00190 const vxl_uint_16 VIL_DICOM_HEADER_IMWINDOWCENTER           =0x1050; // DS
00191 const vxl_uint_16 VIL_DICOM_HEADER_IMWINDOWWIDTH            =0x1051; // DS
00192 const vxl_uint_16 VIL_DICOM_HEADER_IMRESCALEINTERCEPT       =0x1052; // DS
00193 const vxl_uint_16 VIL_DICOM_HEADER_IMRESCALESLOPE           =0x1053; // DS
00194 
00195 // Useful elements from the Pixel group
00196 const vxl_uint_16 VIL_DICOM_HEADER_PXGROUPLENGTH            =0x0000; // UL
00197 const vxl_uint_16 VIL_DICOM_HEADER_PXPIXELDATA              =0x0010; // OW
00198 
00199 // Tags needed in the Delimiter group
00200 const vxl_uint_16 VIL_DICOM_HEADER_DLITEM                   =0xe000;
00201 const vxl_uint_16 VIL_DICOM_HEADER_DLITEMDELIMITATIONITEM   =0xe00d;
00202 const vxl_uint_16 VIL_DICOM_HEADER_DLSEQDELIMITATIONITEM    =0xe0dd;
00203 
00204 
00205 // Defines for the Value Representations for Part10 meta header
00206 const char * const VIL_DICOM_HEADER_APPLICATIONENTRY          ="AE";
00207 const char * const VIL_DICOM_HEADER_AGESTRING                 ="AS";
00208 const char * const VIL_DICOM_HEADER_ATTRIBUTETAG              ="AT";
00209 const char * const VIL_DICOM_HEADER_CODESTRING                ="CS";
00210 const char * const VIL_DICOM_HEADER_DATE                      ="DA";
00211 const char * const VIL_DICOM_HEADER_DECIMALSTRING             ="DS";
00212 const char * const VIL_DICOM_HEADER_DATETIME                  ="DT";
00213 const char * const VIL_DICOM_HEADER_FLOATINGPOINTDOUBLE       ="FD";
00214 const char * const VIL_DICOM_HEADER_FLOATINGPOINTSINGLE       ="FL";
00215 const char * const VIL_DICOM_HEADER_INTEGERSTRING             ="IS";
00216 const char * const VIL_DICOM_HEADER_LONGSTRING                ="LO";
00217 const char * const VIL_DICOM_HEADER_LONGTEXT                  ="LT";
00218 const char * const VIL_DICOM_HEADER_OTHERBYTE                 ="OB";
00219 const char * const VIL_DICOM_HEADER_OTHERWORD                 ="OW";
00220 const char * const VIL_DICOM_HEADER_PERSONNAME                ="PN";
00221 const char * const VIL_DICOM_HEADER_SHORTSTRING               ="SH";
00222 const char * const VIL_DICOM_HEADER_SIGNEDLONG                ="SL";
00223 const char * const VIL_DICOM_HEADER_SEQUENCE                  ="SQ";
00224 const char * const VIL_DICOM_HEADER_SIGNEDSHORT               ="SS";
00225 const char * const VIL_DICOM_HEADER_SHORTTEXT                 ="ST";
00226 const char * const VIL_DICOM_HEADER_TIME                      ="TM";
00227 const char * const VIL_DICOM_HEADER_UNIQUEIDENTIFIER          ="UI";
00228 const char * const VIL_DICOM_HEADER_UNSIGNEDLONG              ="UL";
00229 const char * const VIL_DICOM_HEADER_UNKNOWN                   ="UN";
00230 const char * const VIL_DICOM_HEADER_UNSIGNEDSHORT             ="US";
00231 const char * const VIL_DICOM_HEADER_UNLIMITEDTEXT             ="UT";
00232 
00233 // Enumerations of all VR types
00234 enum vil_dicom_header_vr_type
00235 {
00236   vil_dicom_header_AE,
00237   vil_dicom_header_AS,
00238   vil_dicom_header_AT,
00239   vil_dicom_header_CS,
00240   vil_dicom_header_DA,
00241   vil_dicom_header_DS,
00242   vil_dicom_header_DT,
00243   vil_dicom_header_FD,
00244   vil_dicom_header_FL,
00245   vil_dicom_header_IS,
00246   vil_dicom_header_LO,
00247   vil_dicom_header_LT,
00248   vil_dicom_header_OB,
00249   vil_dicom_header_OW,
00250   vil_dicom_header_PN,
00251   vil_dicom_header_SH,
00252   vil_dicom_header_SL,
00253   vil_dicom_header_SQ,
00254   vil_dicom_header_SS,
00255   vil_dicom_header_ST,
00256   vil_dicom_header_TM,
00257   vil_dicom_header_UI,
00258   vil_dicom_header_UL,
00259   vil_dicom_header_UN,
00260   vil_dicom_header_US,
00261   vil_dicom_header_UT
00262 };
00263 
00264 // maps VR types to C++ types
00265 template <int T /* enum vil_dicom_header_vr_type */>
00266 struct vil_dicom_header_type_of
00267 {
00268   typedef vcl_string type; // preferred C++ type for this VR (specialised below)
00269 };
00270 
00271 #define vr_macro( VR, CPPT ) \
00272   VCL_DEFINE_SPECIALIZATION struct  vil_dicom_header_type_of<VR> { typedef CPPT type; }
00273 
00274 vr_macro( vil_dicom_header_AE, vcl_string );
00275 vr_macro( vil_dicom_header_AS, vcl_string );
00276 vr_macro( vil_dicom_header_AT, vcl_string );
00277 vr_macro( vil_dicom_header_CS, vcl_string );
00278 vr_macro( vil_dicom_header_DA, long );
00279 vr_macro( vil_dicom_header_DS, float );
00280 vr_macro( vil_dicom_header_FD, double );
00281 vr_macro( vil_dicom_header_FL, float );
00282 vr_macro( vil_dicom_header_IS, long );
00283 vr_macro( vil_dicom_header_LO, vcl_string );
00284 vr_macro( vil_dicom_header_LT, vcl_string );
00285 vr_macro( vil_dicom_header_OB, vcl_string );
00286 vr_macro( vil_dicom_header_OW, vcl_string );
00287 vr_macro( vil_dicom_header_PN, vcl_string );
00288 vr_macro( vil_dicom_header_SH, vcl_string );
00289 vr_macro( vil_dicom_header_SL, vxl_sint_32 );
00290 vr_macro( vil_dicom_header_SQ, vcl_string );
00291 vr_macro( vil_dicom_header_SS, vxl_sint_16 );
00292 vr_macro( vil_dicom_header_ST, vcl_string );
00293 vr_macro( vil_dicom_header_TM, float );
00294 vr_macro( vil_dicom_header_UI, vcl_string );
00295 vr_macro( vil_dicom_header_UL, vxl_uint_32 );
00296 vr_macro( vil_dicom_header_UN, vcl_string );
00297 vr_macro( vil_dicom_header_US, vxl_uint_16 );
00298 vr_macro( vil_dicom_header_UT, vcl_string );
00299 #undef vr_macro
00300 
00301 
00302 const vxl_uint_32 VIL_DICOM_HEADER_ALLSET                   = 0xffffffff;
00303 
00304 // For determining the endian of the file or the transfer type (JPEG or RLE)
00305 const char * const VIL_DICOM_HEADER_IMPLICITLITTLE            ="1.2.840.10008.1.2";
00306 const char * const VIL_DICOM_HEADER_EXPLICITLITTLE            ="1.2.840.10008.1.2.1";
00307 const char * const VIL_DICOM_HEADER_EXPLICITBIG               ="1.2.840.10008.1.2.2";
00308 const char * const VIL_DICOM_HEADER_JPEGBASELINE_P1           ="1.2.840.10008.1.2.4.50";
00309 const char * const VIL_DICOM_HEADER_JPEGDEFLOSSY_P2_4         ="1.2.840.10008.1.2.4.51";
00310 const char * const VIL_DICOM_HEADER_JPEGEXTENDED_P3_5         ="1.2.840.10008.1.2.4.52";
00311 const char * const VIL_DICOM_HEADER_JPEGSPECTRAL_P6_8         ="1.2.840.10008.1.2.4.53";
00312 const char * const VIL_DICOM_HEADER_JPEGSPECTRAL_P7_9         ="1.2.840.10008.1.2.4.54";
00313 const char * const VIL_DICOM_HEADER_JPEGFULLPROG_P10_12       ="1.2.840.10008.1.2.4.55";
00314 const char * const VIL_DICOM_HEADER_JPEGFULLPROG_P11_13       ="1.2.840.10008.1.2.4.56";
00315 const char * const VIL_DICOM_HEADER_JPEGLOSSLESS_P14          ="1.2.840.10008.1.2.4.57";
00316 const char * const VIL_DICOM_HEADER_JPEGLOSSLESS_P15          ="1.2.840.10008.1.2.4.58";
00317 const char * const VIL_DICOM_HEADER_JPEGEXTHIER_P16_18        ="1.2.840.10008.1.2.4.59";
00318 const char * const VIL_DICOM_HEADER_JPEGEXTHIER_P17_19        ="1.2.840.10008.1.2.4.60";
00319 const char * const VIL_DICOM_HEADER_JPEGSPECHIER_P20_22       ="1.2.840.10008.1.2.4.61";
00320 const char * const VIL_DICOM_HEADER_JPEGSPECHIER_P21_23       ="1.2.840.10008.1.2.4.62";
00321 const char * const VIL_DICOM_HEADER_JPEGFULLHIER_P24_26       ="1.2.840.10008.1.2.4.63";
00322 const char * const VIL_DICOM_HEADER_JPEGFULLHIER_P25_27       ="1.2.840.10008.1.2.4.64";
00323 const char * const VIL_DICOM_HEADER_JPEGLLESSHIER_P28         ="1.2.840.10008.1.2.4.65";
00324 const char * const VIL_DICOM_HEADER_JPEGLLESSHIER_P29         ="1.2.840.10008.1.2.4.66";
00325 const char * const VIL_DICOM_HEADER_JPEGLLESSDEF_P14_SV1      ="1.2.840.10008.1.2.4.70";
00326 const char * const VIL_DICOM_HEADER_RLELOSSLESS               ="1.2.840.10008.1.2.5";
00327 
00328 //: DICOM information read from the header
00329 //
00330 // This structure is filled when reading the header information from
00331 // a dicom file. Each member relates to a field in the header part
00332 // of the file.
00333 
00334 struct vil_dicom_header_info
00335 {
00336   // General info fields
00337   bool header_valid_;                      /*< True if the header was read ok, otherwise false */
00338   vil_dicom_header_type file_type_;        /*< The type of dicom file */
00339   vil_dicom_header_endian sys_endian_;     /*< The endian of the architecture */
00340   vil_dicom_header_endian file_endian_;    /*< The endian of the file being read */
00341   vil_dicom_header_image_type image_type_; /*< The encapsulated (or not) image type */
00342 
00343   // Identifying fields
00344   vil_dicom_header_type_of<vil_dicom_header_CS>::type image_id_type_;    /*< The image type from the dicom header */
00345   vil_dicom_header_type_of<vil_dicom_header_UI>::type sop_cl_uid_;       /*< The class unique id for the Service/Object Pair */
00346   vil_dicom_header_type_of<vil_dicom_header_UI>::type sop_in_uid_;       /*< The instance uid for the SOP */
00347   vil_dicom_header_type_of<vil_dicom_header_DA>::type study_date_;             /*< The date of the study */
00348   vil_dicom_header_type_of<vil_dicom_header_DA>::type series_date_;            /*< The date this series was collected */
00349   vil_dicom_header_type_of<vil_dicom_header_DA>::type acquisition_date_;       /*< The date of acquisition */
00350   vil_dicom_header_type_of<vil_dicom_header_DA>::type image_date_;             /*< The date of this image */
00351   vil_dicom_header_type_of<vil_dicom_header_TM>::type study_time_;            /*< The time of the study */
00352   vil_dicom_header_type_of<vil_dicom_header_TM>::type series_time_;           /*< The time of the series */
00353   vil_dicom_header_type_of<vil_dicom_header_TM>::type acquisition_time_;      /*< The time of acquisition */
00354   vil_dicom_header_type_of<vil_dicom_header_TM>::type image_time_;            /*< The time of the image */
00355   vil_dicom_header_type_of<vil_dicom_header_SH>::type accession_number_; /*< The accession number for this image */
00356   vil_dicom_header_type_of<vil_dicom_header_CS>::type modality_;         /*< The imaging modality */
00357   vil_dicom_header_type_of<vil_dicom_header_LO>::type manufacturer_;     /*< The name of the scanner manufacturer */
00358   vil_dicom_header_type_of<vil_dicom_header_LO>::type institution_name_; /*< The name of the institution */
00359   vil_dicom_header_type_of<vil_dicom_header_ST>::type institution_addr_; /*< The address of the institution */
00360   vil_dicom_header_type_of<vil_dicom_header_PN>::type ref_phys_name_;    /*< The name of the referring physician */
00361   vil_dicom_header_type_of<vil_dicom_header_SH>::type station_name_;     /*< The name of the station used */
00362   vil_dicom_header_type_of<vil_dicom_header_LO>::type study_desc_;       /*< A description of the study */
00363   vil_dicom_header_type_of<vil_dicom_header_LO>::type series_desc_;      /*< A description of the series */
00364   vil_dicom_header_type_of<vil_dicom_header_PN>::type att_phys_name_;    /*< The name of the attending physician */
00365   vil_dicom_header_type_of<vil_dicom_header_PN>::type operator_name_;    /*< The name of the MR operator */
00366   vil_dicom_header_type_of<vil_dicom_header_LO>::type model_name_;       /*< The name of the MR scanner model */
00367 
00368   // Patient info
00369   vil_dicom_header_type_of<vil_dicom_header_PN>::type patient_name_;  /*< Patient's name */
00370   vil_dicom_header_type_of<vil_dicom_header_LO>::type patient_id_;    /*< Patient's ID */
00371   vil_dicom_header_type_of<vil_dicom_header_DA>::type patient_dob_;         /*< The patient's date of birth */
00372   vil_dicom_header_type_of<vil_dicom_header_CS>::type patient_sex_;   /*< The sex of the patient */
00373   vil_dicom_header_type_of<vil_dicom_header_AS>::type patient_age_;   /*< The age of the patient */
00374   vil_dicom_header_type_of<vil_dicom_header_DS>::type patient_weight_;     /*< The weight of the patient */
00375   vil_dicom_header_type_of<vil_dicom_header_LT>::type patient_hist_;  /*< Any additional patient history */
00376 
00377   // Acquisition Info
00378   vil_dicom_header_type_of<vil_dicom_header_CS>::type scanning_seq_;  /*< A description of the scanning sequence */
00379   vil_dicom_header_type_of<vil_dicom_header_CS>::type sequence_var_;  /*< A description of the sequence variant */
00380   vil_dicom_header_type_of<vil_dicom_header_CS>::type scan_options_;  /*< A description of various scan options */
00381   vil_dicom_header_type_of<vil_dicom_header_CS>::type mr_acq_type_;   /*< The acquisition type for this scan */
00382   vil_dicom_header_type_of<vil_dicom_header_SH>::type sequence_name_; /*< The name of the sequence */
00383   vil_dicom_header_type_of<vil_dicom_header_CS>::type angio_flag_;    /*< The angio flag for this sequence */
00384   vil_dicom_header_type_of<vil_dicom_header_DS>::type slice_thickness_;    /*< Slice thickness (for voxel size) */
00385   vil_dicom_header_type_of<vil_dicom_header_DS>::type repetition_time_;    /*< Scan repetition time */
00386   vil_dicom_header_type_of<vil_dicom_header_DS>::type echo_time_;          /*< Scan echo time */
00387   vil_dicom_header_type_of<vil_dicom_header_DS>::type inversion_time_;     /*< Scan inversion time */
00388   vil_dicom_header_type_of<vil_dicom_header_DS>::type number_of_averages_; /*< The number of averages for this scan */
00389   vil_dicom_header_type_of<vil_dicom_header_IS>::type echo_numbers_;         /*< The echo numbers for this scan */
00390   vil_dicom_header_type_of<vil_dicom_header_DS>::type mag_field_strength_; /*< The strength of the magnetic field */
00391   vil_dicom_header_type_of<vil_dicom_header_IS>::type echo_train_length_;    /*< The length of the echo train */
00392   vil_dicom_header_type_of<vil_dicom_header_DS>::type pixel_bandwidth_;    /*< The bandwidth of the pixels */
00393   vil_dicom_header_type_of<vil_dicom_header_LO>::type software_vers_; /*< Versions of the scanner software used */
00394   vil_dicom_header_type_of<vil_dicom_header_LO>::type protocol_name_; /*< The name of the protocol used */
00395   vil_dicom_header_type_of<vil_dicom_header_IS>::type heart_rate_;           /*< The patient's heart rate */
00396   vil_dicom_header_type_of<vil_dicom_header_IS>::type card_num_images_;      /*< The cardiac number of images */
00397   vil_dicom_header_type_of<vil_dicom_header_IS>::type trigger_window_;       /*< The trigger window for this image */
00398   vil_dicom_header_type_of<vil_dicom_header_DS>::type reconst_diameter_;   /*< The reconstruction diameter */
00399   vil_dicom_header_type_of<vil_dicom_header_SH>::type receiving_coil_;/*< Details of the receiving coil */
00400   vil_dicom_header_type_of<vil_dicom_header_CS>::type phase_enc_dir_; /*< The phase encoding direction */
00401   vil_dicom_header_type_of<vil_dicom_header_DS>::type flip_angle_;         /*< The flip angle */
00402   vil_dicom_header_type_of<vil_dicom_header_DS>::type sar_;                /*< The specific absorption rate */
00403   vil_dicom_header_type_of<vil_dicom_header_CS>::type patient_pos_;   /*< The position of the patient in the scanner */
00404 
00405   // Relationship info
00406   vil_dicom_header_type_of<vil_dicom_header_UI>::type stud_ins_uid_;  /*< The study instance unique id */
00407   vil_dicom_header_type_of<vil_dicom_header_UI>::type ser_ins_uid_;   /*< The series instance unique id */
00408   vil_dicom_header_type_of<vil_dicom_header_SH>::type study_id_;      /*< The id of this study */
00409   vil_dicom_header_type_of<vil_dicom_header_IS>::type series_number_;        /*< The number of this series */
00410   vil_dicom_header_type_of<vil_dicom_header_IS>::type acquisition_number_;   /*< The number of the acquisition */
00411   vil_dicom_header_type_of<vil_dicom_header_IS>::type image_number_;         /*< The number of this image instance */
00412   vil_dicom_header_type_of<vil_dicom_header_CS>::type pat_orient_;    /*< The orientation of the patient */
00413   vcl_vector<vil_dicom_header_type_of<vil_dicom_header_DS>::type> image_pos_;     /*< The image position relative to the patient */
00414   vcl_vector<vil_dicom_header_type_of<vil_dicom_header_DS>::type> image_orient_;  /*< The image orientation relative to the patient */
00415   vil_dicom_header_type_of<vil_dicom_header_UI>::type frame_of_ref_;  /*< The frame of reference */
00416   vil_dicom_header_type_of<vil_dicom_header_IS>::type images_in_acq_;        /*< Then number ot images in the acquisition */
00417   vil_dicom_header_type_of<vil_dicom_header_LO>::type pos_ref_ind_;   /*< The position reference indicator */
00418   vil_dicom_header_type_of<vil_dicom_header_DS>::type slice_location_;     /*< The location of the slice */
00419   vil_dicom_header_type_of<vil_dicom_header_LT>::type image_comments_;  /*< The image comments */
00420 
00421   // Image info
00422   vil_dicom_header_type_of<vil_dicom_header_US>::type pix_samps_; /*< The number of samples per pixel */
00423   vil_dicom_header_type_of<vil_dicom_header_CS>::type photo_interp_;  /*< The photometric interpretation */
00424   vil_dicom_header_type_of<vil_dicom_header_US>::type size_x_;      /*< The number of columns */
00425   vil_dicom_header_type_of<vil_dicom_header_US>::type size_y_;      /*< The number of rows */
00426   vil_dicom_header_type_of<vil_dicom_header_US>::type size_z_;      /*< The number of planes */
00427   vil_dicom_header_type_of<vil_dicom_header_US>::type high_bit_;  /*< The bit used as the high bit */
00428   vil_dicom_header_type_of<vil_dicom_header_US>::type small_im_pix_val_;   /*< The smallest image pixel value */
00429   vil_dicom_header_type_of<vil_dicom_header_US>::type large_im_pix_val_;   /*< The largest image pixel value */
00430   vil_dicom_header_type_of<vil_dicom_header_US>::type pixel_padding_val_;  /*< The value used for padding pixels */
00431   vil_dicom_header_type_of<vil_dicom_header_DS>::type window_centre_;      /*< The value of the image window's centre */
00432   vil_dicom_header_type_of<vil_dicom_header_DS>::type window_width_;       /*< The actual width of the image window */
00433 
00434   // Info from the tags specifically for reading the image data
00435   vil_dicom_header_type_of<vil_dicom_header_DS>::type spacing_x_;                   /*< The pixel spacing in x */
00436   vil_dicom_header_type_of<vil_dicom_header_DS>::type spacing_y_;                   /*< The pixel spacing in y */
00437   vil_dicom_header_type_of<vil_dicom_header_DS>::type spacing_slice_;           /*< The pixel spacing in z */
00438   vil_dicom_header_type_of<vil_dicom_header_DS>::type res_intercept_;           /*< The image rescale intercept */
00439   vil_dicom_header_type_of<vil_dicom_header_DS>::type res_slope_;               /*< The image rescale slope */
00440   vil_dicom_header_type_of<vil_dicom_header_US>::type pix_rep_;        /*< The pixel representation (+/-) */
00441   vil_dicom_header_type_of<vil_dicom_header_US>::type stored_bits_;    /*< The bits stored */
00442   vil_dicom_header_type_of<vil_dicom_header_US>::type allocated_bits_; /*< The bits allocated */
00443 };
00444 
00445 
00446 //: Clears a header info struct
00447 // \relatesalso vil_dicom_header_info
00448 void vil_dicom_header_info_clear( vil_dicom_header_info& info );
00449 
00450 
00451 const short VIL_DICOM_HEADER_UNSPECIFIED = -1;
00452 const unsigned short VIL_DICOM_HEADER_UNSPECIFIED_UNSIGNED = (unsigned short) -1;
00453 const double VIL_DICOM_HEADER_DEFAULTSIZE = 1.0;
00454 const float VIL_DICOM_HEADER_DEFAULTSIZE_FLOAT = 1.0f;
00455 const float VIL_DICOM_HEADER_DEFAULTINTERCEPT = 0.0f;
00456 const float VIL_DICOM_HEADER_DEFAULTSLOPE = 1.0f;
00457 
00458 //: A class to read and write the header part of a dicom file
00459 //
00460 //  This class reads and writes the header section of a dicom file,
00461 //  determining the type and storing the information in a dicom
00462 //  structure.
00463 class vil_dicom_header_format
00464 {
00465  public:
00466 
00467   vil_dicom_header_format();
00468  ~vil_dicom_header_format();
00469 
00470   //: True if it is known DICOM format
00471   bool isDicomFormat(vil_stream &);
00472 
00473   //: Read the dicom header into a header struct
00474   //  Reads the header section of the dicom file and stores the
00475   //  result in a header struct, which it returns. When finished,
00476   // the file stream should be pointing at the start of the image
00477   // data
00478   // \param fs The file stream to read - on exit points to the start of the image data
00479   // \return A dicom header struct containing the info gained from the header
00480   // \sa lastHeader(), headerValid(), last_read_() and info_valid_()
00481   vil_dicom_header_info readHeader(vil_stream &fs);
00482 
00483   //: Method to return the last struct of header info set
00484   //
00485   //  The class holds a dicom header info struct containing the
00486   //  info from the last dicom file read.
00487   //  \return A dicom header struct containing the info gained from the last header read
00488   vil_dicom_header_info lastHeader(void);
00489 
00490   //: Method to indicate if the header info held is valid or not
00491   //
00492   //  \return TRUE if the header info is valid, otherwise false
00493   bool headerValid(void);
00494 
00495   //: Return the current system endian
00496   //
00497   //  \return The system endian for the architecture running the application
00498   vil_dicom_header_endian systemEndian(void);
00499 
00500   //: Return the endian of the header being read
00501   //
00502   //  \return The endian of the file currently being read.
00503   //  \sa determineMetaInfo() and file_endian_()
00504 
00505   vil_dicom_header_endian fileEndian(void);
00506 
00507   //: Return any encapsulated image type
00508   //
00509   //  \return The encapsulated image type of the file currently being read.
00510   vil_dicom_header_image_type imageType(void);
00511 
00512  private:
00513 
00514   //: Method to determine the file type
00515   //
00516   //  \param fs The file stream for the image to test
00517   //  \return The dicom file type or unknown
00518   vil_dicom_header_type determineFileType(vil_stream &fs);
00519 
00520   //: Method to read the elements from the header
00521   //
00522   //  This method fills the last_read_ header structure with
00523   //  the necessary fields
00524   //  \param fs The file stream to read from
00525   //  \sa readIdentifyingElements(), readPatientElements(),
00526   //      readAcquisitionElements(), readRelationshipElements(),
00527   //      readImageElements, readDelimiterElements(),
00528   //      readHeader() and last_read_()
00529   void readHeaderElements(vil_stream &fs);
00530 
00531   //: Method to read the identifying group's details
00532   //
00533   //  Fills the identifying details in the last_read_ structure
00534   //  from the file header
00535   //  \param element The element being read in the identifying
00536   //                 group
00537   //  \param dblock_size The size of the data block for this
00538   //                     element
00539   //  \param fs The file stream to read from
00540   //  \sa readHeaderElements(), readPatientElements(),
00541   //      readAcquisitionElements(), readRelationshipElements(),
00542   //      readImageElements(), readDelimiterElements() and last_read_()
00543   void readIdentifyingElements(short element, int dblock_size,
00544                                vil_stream &fs);
00545 
00546   //: Method to read the patient details
00547   //
00548   //  Fills the patient details in the last_read_ structure from
00549   //  the file header
00550   //  \param element The element being read in the patient group
00551   //  \param dblock_size The size of the data block for this
00552   //                     element
00553   //  \param fs The file stream to read from
00554   //  \sa readHeaderElements(), readIdentifyingElements(),
00555   //      readAcquisitionElements(), readRelationshipElements(),
00556   //      readImageElements(), readDelimiterElements() and last_read_()
00557   void readPatientElements(short element, int dblock_size,
00558                            vil_stream &fs);
00559 
00560   //: Method to read the acquisition group's details
00561   //
00562   //  Fills the acquisition details in the last_read_ structure
00563   //  from the file header
00564   //  \param element The element being read in the acquisition
00565   //                 group
00566   //  \param dblock_size The size of the data block for this
00567   //                     element
00568   //  \param fs The file stream to read from
00569   //  \sa readHeaderElements(), readIdentifyingElements(),
00570   //      readPatientElements(), readRelationshipElements(),
00571   //      readImageElements(), readDelimiterElements() and last_read_()
00572   void readAcquisitionElements(short element, int dblock_size,
00573                                vil_stream &fs);
00574 
00575   //: Method to read the relationship group's details
00576   //
00577   //  Fills the relationship details in the last_read_ structure
00578   //  from the file header
00579   //  \param element The element being read in the relationship
00580   //                 group
00581   //  \param dblock_size The size of the data block for this
00582   //                     element
00583   //  \param fs The file stream to read from
00584   //  \sa readHeaderElements(), readIdentifyingElements(),
00585   //      readPatientElements(), readAcquisitionElements(),
00586   //    readImageElements(), readDelimiterElements()
00587   //    and last_read_()
00588   void readRelationshipElements(short element, int dblock_size,
00589                                 vil_stream &fs);
00590 
00591   //: Method to read the image group's details
00592   //
00593   //  Fills the image details in the last_read_ structure from
00594   //  the file header
00595   //  \param element The element being read in the image group
00596   //  \param dblock_size The size of the data block for this
00597   //                     element
00598   //  \param fs The file stream to read from
00599   //  \sa readHeaderElements(), readIdentifyingElements(),
00600   //      readPatientElements(), readAcquisitionElements(),
00601   //    readRelationshipElements(), readDelimiterElements()
00602   //    and last_read_()
00603   void readImageElements(short element, int dblock_size,
00604                          vil_stream &fs);
00605 
00606   //: Method to read the delimiter group's details
00607   //
00608   //  Certain field in the delimiter group have no data block, and
00609   //  so should not be skipped. This method takes the appropriate
00610   //  action - to skip or not to skip
00611   //  \param element The element being read in the delimiter group
00612   //  \param dblock_size The size of the data block for this element
00613   //  \param fs The file stream to read from
00614   //  \sa readHeaderElements(), readIdentifyingElements(),
00615   //      readPatientElements(), readAcquisitionElements(),
00616   //    readRelationshipElements(), readImageElements()
00617   //    and last_read_()
00618   void readDelimiterElements(short element, int dblock_size,
00619                              vil_stream &fs);
00620 
00621   //: Method to convert the Value Representation (VR) (if it exists)
00622   //
00623   //  \param data_block Contains the VR or data block size (always
00624   //                    holds the data block size on exit
00625   //  \param fs The file stream to read from
00626   //  \sa readHeaderElements()
00627   bool convertValueRepresentation(unsigned int &dblock_size,
00628                                   vil_stream &ifs);
00629 
00630   //: Method to determine whether or not the actual pixel data has been reached
00631   //
00632   //  \param group The current group to test
00633   //  \param element The element within that group
00634   //  \return TRUE if it is the pixel data, otherwise false
00635   //  \sa readHeaderElements()
00636   bool pixelDataFound(short group, short element);
00637 
00638   // Method to clear a header info struct
00639   //
00640   //  \sa last_read_() and info_valid_()
00641   void clearInfo(void);
00642 
00643   //: Work out whether the current architecture is big or little endian
00644   //
00645   //  \return The system endian value calculated
00646   //  \sa systemEndian() and endian_()
00647   vil_dicom_header_endian calculateEndian(void);
00648 
00649   //: Initialise all the necessary meta-file stuff
00650   //
00651   //  \return The endian of the file
00652   //  \sa fileEndian(), file_endian_(), imageType(), and image_type_();
00653   vil_dicom_header_endian determineMetaInfo(vil_stream &fs);
00654 
00655   //: Method to byte swap an unsigned short int if necessary
00656   //
00657   //  \param short_in The unsigned short to swap
00658   //  \return The swapped unsigned short
00659   //  \sa intSwap() and charSwap()
00660   vxl_uint_16 shortSwap(vxl_uint_16 short_in);
00661 
00662   //: Method to byte swap an unsigned int if necessary
00663   //
00664   //  \param int_in The unsigned int to swap
00665   //  \return The swapped unsigned int
00666   //  \sa shortSwap() and charSwap()
00667   vxl_uint_32 intSwap(vxl_uint_32 int_in);
00668 
00669   //: Method to swap a number inside a char array
00670   //
00671   //  \param char_in The char array to swap - on exit contains the result
00672   //  \param val_size The size of the var to swap
00673   void charSwap(char *char_in, int val_size);
00674 
00675  private:
00676 
00677   //: Holds the info from the last header read
00678   //
00679   //  \sa readHeader(), lastHeader(), headerValid(), clearInfo(),
00680   //      readHeaderElements() and info_valid_()
00681   vil_dicom_header_info last_read_;
00682 
00683   //: TRUE if the header info is valid (i.e. has been read) otherwise FALSE
00684   //
00685   // \sa readHeader(), lastHeader(), headerValid(), clearInfo() and last_read_()
00686   bool info_valid_;
00687 
00688   //: A variable to hold the discovered architecture endian
00689   //
00690   //  \sa calculateEndian() and systemEndian()
00691   vil_dicom_header_endian endian_;
00692 
00693   //: A variable to hold the current header file's endian
00694   //
00695   //  \sa determineMetaInfo() and fileEndian()
00696   vil_dicom_header_endian file_endian_;
00697 
00698   //: A variable to hole the current encapsulate file type (if any)
00699   //
00700   //    \sa determineMetaInfo() and imageType()
00701   vil_dicom_header_image_type image_type_;
00702 };
00703 
00704 void vil_dicom_header_print(vcl_ostream &os, const vil_dicom_header_info &s);
00705 
00706 #endif // vil_dicom_header_h_