00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGE4ImageIO.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006/02/05 20:57:46 $ 00007 Version: $Revision: 1.9 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 00034 #ifndef __itkGE4ImageIO_h 00035 #define __itkGE4ImageIO_h 00036 00037 #include "itkIPLCommonImageIO.h" 00038 #include "itkImageIOBase.h" 00039 #include "itkGEImageHeader.h" 00040 00041 #include <fstream> 00042 00043 namespace itk 00044 { 00045 00053 class ITK_EXPORT GE4ImageIO : public IPLCommonImageIO 00054 { 00055 public: 00057 typedef GE4ImageIO Self; 00058 typedef IPLCommonImageIO Superclass; 00059 typedef SmartPointer<Self> Pointer; 00060 00062 itkNewMacro(Self); 00063 00065 itkTypeMacro(GE4ImageIO, Superclass); 00066 00067 /*-------- This part of the interfaces deals with reading data. ----- */ 00068 00075 virtual bool CanReadFile(const char* FileNameToRead) ; 00076 00078 // Implemented in superclass 00079 // virtual void ReadImageInformation(); 00080 00082 // Implemented in superclass 00083 // virtual const std::type_info& GetPixelType() const; 00084 00086 // Implemented in superclass 00087 // virtual void Read(void* buffer); 00088 00092 // Implemented in superclass 00093 // virtual unsigned int GetComponentSize() const; 00094 00095 /*-------- This part of the interfaces deals with writing data. ----- */ 00096 00103 // Implemented in superclass 00104 // virtual bool CanWriteFile(const char * FileNameToWrite); 00105 00107 // Implemented in superclass 00108 // virtual void WriteImageInformation(); 00109 00112 // Implemented in superclass 00113 // virtual void Write(const void* buffer); 00114 protected: 00115 GE4ImageIO(); 00116 ~GE4ImageIO(); 00117 // Implemented in Superclass 00118 // void PrintSelf(std::ostream& os, Indent indent) const; 00119 virtual struct GEImageHeader *ReadHeader(const char *FileNameToRead); 00120 private: 00121 GE4ImageIO(const Self&); //purposely not implemented 00122 float MvtSunf (int numb); 00123 enum Study_Header_offsets { 00124 STHDR_ID= 0, // Study Header Identifier 00125 STHDR_REV= 7, // Study Header Revision Number 00126 STHDR_BLKS= 11, // Number of Study Header Blocks 00127 STHDR_CRTRP= 12, // Study Header Creator (Process 00128 STHDR_CRTRT= 28, // Study Header Creator (Task 00129 STHDR_RAWNM= 29, // Raw Data Study Number 00130 STHDR_STNUM= 32, // Study Number 00131 STHDR_RAWID= 35, // Raw Data System ID 00132 STHDR_SGENID= 37, // System Generation ID 00133 STHDR_DATE= 39, // Date of Study (ascii 00134 STHDR_IDATE= 44, // Date of Study (integer 00135 STHDR_TIME= 47, // Time of Study (ascii 00136 STHDR_ITIME= 51, // Time of Study (integer 00137 STHDR_PNM= 54, // Patient Name 00138 STHDR_PID= 70, // Patient ID 00139 STHDR_PIDTMP= 76, // Patient ID padding for future exp. 00140 STHDR_AGE= 78, // Age of patient 00141 STHDR_SEX= 80, // Sex of patient 00142 STHDR_WGHT= 81, // Weight of the patient in grams 00143 STHDR_RFR= 83, // Refered by 00144 STHDR_DGN= 99, // Diognostician 00145 STHDR_OP= 115, // Operator 00146 STHDR_DESC= 131, // Description 00147 STHDR_HIST= 161, // History 00148 STHDR_STIME= 221, // Creation time in seconds. 00149 STHDR_HOSP= 223, // Hospital name 00150 STHDR_STAT= 239, // Patient status 00151 STHDR_RSRV1= 240, // GE NMR Reserved Area 00152 STHDR_RSRV2= 256, // GE NMR Reserved Area 00153 STHDR_CHECK= 511 // Study Header Checksum 00154 }; 00155 enum Series_Header_Offsets { 00156 SEHDR_ID= 0, // Series Header Identifier 00157 SEHDR_REV= 7, // Series Header Revision Number 00158 SEHDR_BLKS= 11, // Number of Series Header Blocks 00159 SEHDR_CRTRP= 12, // Series Header Creator (Proc 00160 SEHDR_CRTRT= 28, // Series Header Creator (Task 00161 SEHDR_RAWNM= 29, // Original Series Number 00162 SEHDR_SERNUM= 31, // Series Number 00163 SEHDR_RAWID= 33, // Raw Data System ID 00164 SEHDR_SGENID= 35, // System Generation ID 00165 SEHDR_DATE= 37, // Date of series (ascii 00166 SEHDR_IDATE= 42, // Date of series (integer 00167 SEHDR_TIME= 45, // Time of Series (ascii 00168 SEHDR_ITIME= 49, // Time of Series (integer 00169 SEHDR_DESC= 52, // Series Description 00170 SEHDR_TYPE= 112, // Series Type 00171 SEHDR_CTYPE= 113, // Coil Type 00172 SEHDR_CNAME= 114, // Coil Name 00173 SEHDR_CNTRDESC= 122, // Contrast Description 00174 SEHDR_PTYPE= 138, // Plane Type 00175 SEHDR_PNAME= 139, // Plane Name 00176 SEHDR_IMODE= 147, // Image Mode 00177 SEHDR_FSTREN= 148, // Magnetic Field Strength 00178 SEHDR_PSEQ= 149, // Pulse Sequence 00179 SEHDR_PSSTYPE= 150, // Pulse sequence subtype 00180 SEHDR_FOV= 151, // Field of view 00181 SEHDR_CENTER= 153, // Center 00182 SEHDR_ORIEN= 159, // Orientation 00183 SEHDR_POS= 160, // Position 00184 SEHDR_ANREF= 161, // Longitudinal Anotomical Reference 00185 SEHDR_VANREF= 177, // Vertical Anotomical Reference 00186 SEHDR_VERLAN= 193, // Vertical Landmark 00187 SEHDR_HORLAN= 195, // Horizontal Landmark 00188 SEHDR_TBLLOC= 197, // Physical Table Location 00189 SEHDR_SMATRIX= 199, // Scan Matrix 00190 SEHDR_IMATRIX= 201, // Image Matrix 00191 SEHDR_IALLOC= 202, // No. of Images Allocated 00192 SEHDR_GTYP= 203, // Gating Type 00193 SEHDR_PSMODE= 204, // Pulse sequence mode 00194 SEHDR_DNAME= 205, // PSD name from NAME = aPPL psd name 00195 SEHDR_LNDMRK= 211, // Landmark counter 00196 SEHDR_PROTO= 213, // Protocol name for Scan 00197 SEHDR_SCOIL_TYPE= 223, // Surface coil type 00198 SEHDR_SUPP_TECH= 224, // Suppression technique 00199 SEHDR_RSRV1= 225, // GE NMR Reserved 00200 SEHDR_RSRV2= 256, // GE NMR Reserved 00201 SEHDR_CHECK= 511 // Checksum for Series Header 00202 }; 00203 enum Image_Header_Offsets { 00204 IHDR_ID= 0, // Image Header Identifier 00205 IHDR_REV= 7, // Image Header Revision Number 00206 IHDR_BLKS= 11, // Number of Image Header Blocks 00207 IHDR_CRTRP= 12, // Image Header Creator (Proc 00208 IHDR_CRTRT= 28, // Image Header Creator (Task 00209 IHDR_DATE= 29, // Image Creation Date (ascii 00210 IHDR_IDATE= 34, // Image Creation Date (integer 00211 IHDR_TIME= 37, // Image Creation Time (ascii 00212 IHDR_ITIME= 41, // Image Creation Time (integer 00213 IHDR_IMNUM= 44, // Image Number 00214 IHDR_SERNM= 46, // Series Number of Image 00215 IHDR_RAWID= 48, // Raw Data System ID 00216 IHDR_SGENID= 50, // System Generation ID 00217 IHDR_STRTX= 52, // Start Location X, Right min 00218 IHDR_ENDX= 54, // End Location X, Right max 00219 IHDR_STRTY= 56, // Start Location Y, Anterior min 00220 IHDR_ENDY= 58, // End Location Y, Anterior max 00221 IHDR_STRTZ= 60, // Start Location Z, Superior min 00222 IHDR_ENDZ= 62, // End Location Z, Superior max 00223 IHDR_OBLIQUE= 64, // Reserved for future use. 00224 IHDR_LOCATN= 73, // Image Location 00225 IHDR_TBLPOS= 75, // Table Position 00226 IHDR_THICK= 77, // Thickness 00227 IHDR_SPACE= 79, // Spacing 00228 IHDR_ROUND= 81, // Round 00229 IHDR_TR= 82, // Repititon/Recovery Time 00230 IHDR_TS= 84, // Scan Time 00231 IHDR_TE= 86, // Echo Delay 00232 IHDR_TI= 88, // Inversion Time 00233 IHDR_TY= 90, // Reserved for future use. 00234 IHDR_NECHO= 98, // Number of echos. 00235 IHDR_ECHON= 99, // Echo number. 00236 IHDR_SLQUANT= 100, // Number of slices in scan group. 00237 IHDR_NAVE= 101, // Number of averages. 00238 IHDR_RSRCH= 102, // Research mode used ? 00239 IHDR_PNAME= 103, // Name of PSD file. 00240 IHDR_PSDDT= 119, // Creation Date of PSD file. 00241 IHDR_GPRE= 125, // Graphically Prescribed ? 00242 IHDR_PSERIES= 126, // Prescribed Series Numbers 00243 IHDR_PIMAGES= 131, // Prescribed Image Numbers 00244 IHDR_SHAPE= 136, // Image Shape 00245 IHDR_X= 137, // X pixel dimension 00246 IHDR_Y= 138, // Y pixel dimension 00247 IHDR_PIXSIZ= 139, // Pixel Size 00248 IHDR_CMPRS= 141, // Image Compressed ? 00249 IHDR_BITPIX= 142, // Bits per Pixel 00250 IHDR_WINDOW= 143, // Default Window 00251 IHDR_LEVEL= 144, // Default Level 00252 IHDR_IFBLKS= 145, // Number of Blocks in File 00253 IHDR_NEX= 146, // Number of excitations (Real . 00254 IHDR_PSAR= 148, // Value of peak SAR (Real . 00255 IHDR_ASAR= 150, // Value of average SAR (Real . 00256 IHDR_MONITOR= 152, // SAR monitored ? 00257 IHDR_CONTIG= 153, // Contiguous slices ? 00258 IHDR_HRT_RT= 154, // Cardiac Heart Rate 00259 IHDR_DEL_TRG= 155, // Total Delay Time After Trigger 00260 IHDR_ARR= 157, // Arrhythmia Rejection Ratio 00261 IHDR_RTIME= 158, // Cardiac Rep Time 00262 IHDR_IMGS_PCY= 159, // Images per Cardiac Cycle 00263 IHDR_ARRS_SCN= 160, // Number of ARR's during the Scan 00264 IHDR_XMTATTN= 162, // Transmit attenuator setting 00265 IHDR_RCVATTN= 163, // Recieve attenuator setting 00266 IHDR_FLDSTR= 164, // Magnetic Field Strength 00267 IHDR_IMG_OFF= 166, // Image offser 00268 IHDR_INTR_DEL= 167, // Inter image/inter location delay 00269 IHDR_IHDR_DNAME=169, // PSD name from NAME = aPPL psd name 00270 IHDR_FLPANG= 175, // Flip angle for GRASS 00271 IHDR_SC_TYPE= 176, // Type of correction for surface coils 00272 IHDR_SC_SER= 178, // Series no. of corrected/uncor images 00273 IHDR_SC_IMA= 180, // Image no. of corrected/uncor images 00274 IHDR_SC_EXTR= 182, // Extremety coil? true/false 00275 IHDR_SC_RSRV= 183, // Reserved for future surface coil use 00276 IHDR_PSERIES_2= 193, // Series no. of second localizer 00277 IHDR_PIMAGE_2= 195, // Image no. of second localizer 00278 IHDR_R_CC= 197, // R center coordinate on plane image 00279 IHDR_A_CC= 199, // A center coordinate on plane image 00280 IHDR_S_CC= 201, // S center coordinate on plane image 00281 IHDR_R_NC= 203, // R normal coordinate 00282 IHDR_A_NC= 205, // A normal coordinate 00283 IHDR_S_NC= 207, // S normal coordinate 00284 IHDR_TLHC_R= 209, // TLHC R coordinate 00285 IHDR_TLHC_A= 211, // TLHC A coordinate 00286 IHDR_TLHC_S= 213, // TLHC S coordinate 00287 IHDR_TRHC_R= 215, // TRHC R coordinate 00288 IHDR_TRHC_A= 217, // TRHC A coordinate 00289 IHDR_TRHC_S= 219, // TRHC S coordinate 00290 IHDR_BLHC_R= 221, // BLHC R coordinate 00291 IHDR_BLHC_A= 223, // BLHC A coordinate 00292 IHDR_BLHC_S= 225, // BLHC S coordinate 00293 IHDR_DISCLMR= 227, // Image header disclamer 00294 IHDR_MINDAT= 228, // Minimum delay after trigger 00295 IHDR_CPHASE= 229, // Multiplier of slices to obtain phase 00296 IHDR_TE2= 230, // TE2 (VEMP) 00297 IHDR_SWAP_PF= 232, // swap phase/frequency axis 00298 IHDR_PAUSIN= 233, // Pause interval 00299 IHDR_PAUSTM= 234, // Pause time 00300 IHDR_USET= 236, // Bitmap defining users CVs 00301 IHDR_USER0= 237, // User defined variables that are PSD dependent 00302 IHDR_USER1= 239, 00303 IHDR_USER2= 241, 00304 IHDR_USER3= 243, 00305 IHDR_USER4= 245, 00306 IHDR_USER5= 247, 00307 IHDR_USER6= 249, 00308 IHDR_USER7= 251, 00309 IHDR_USER8= 253, 00310 IHDR_USER9= 255, 00311 IHDR_OBPLANE= 257, // Oblique pl 00312 IHDR_CNTRST= 258, // BOOLEAN - was contrast used? 00313 IHDR_CSTAGNT= 259, // Contrast agent 00314 IHDR_CSTAMT= 264, // Contrast amount 00315 IHDR_FILFMT= 266, // FILE format (3.0 or earlier 00316 IHDR_AUTOCF= 267, // Auto center frequency 00317 IHDR_XMTFREQ= 268, // Actual transmit freq usen on scan 00318 IHDR_RCVFREQ= 270, // Actual receive freq usen on scan 00319 IHDR_AUTOXMTFERQ=272, // Recommended automated transmit freq 00320 IHDR_AUTORCVFREQ=274, // Recommended automated receive freq 00321 IHDR_AUTOXMTATTN=276, // Recommended automated transmit attenuation 00322 IHDR_AUTORCVATTN=278, // Recommended automated receive attenuation 00323 IHDR_HISTO= 280, // is histogram present in raw header 00324 IHDR_PF_SWAPPED= 281, // Swapped phase/frequency - true/false 00325 IHDR_R1= 282, // for prescan 00326 IHDR_R2= 283, // for prescan 00327 IHDR_VBW= 284, // Variable bandwidth 00328 IHDR_RSRV2= 285, // GE NMR Reserved 00329 IHDR_CHECK= 511 // Image Header Checksum 00330 }; 00331 enum DSS_Header_Offsets { 00332 DSSHDR_ID= 0, // DSS Header Identifier 00333 DSSHDR_REV= 7, // DSS Header Revision Number 00334 DSSHDR_BLKS= 11, // Number of DSS Header Blocks 00335 DSSHDR_CRTRP= 12, // DSS Header Creator (process 00336 DSSHDR_CRTRT= 28, // DSS Header Creator (task 00337 DSSHDR_DATE= 29, // Date of Creation (ascii 00338 DSSHDR_IDATE= 34, // Date of Creation (integer 00339 DSSHDR_TIME= 37, // Time of Creation (ascii 00340 DSSHDR_ITIME= 41, // Time of Creation (integer 00341 DSSHDR_TLM= 44, // Time the DSSHDR was last modified 00342 DSSHDR_ASTAT= 46, // Study Archive Status 00343 DSSHDR_APEND= 47, // Study archive pending count. 00344 DSSHDR_SPEND= 48, // Substructure archive pending count. 00345 DSSHDR_LOCK= 49, // Resource locking queue desc 00346 DSSHDR_STLST= 57, // IDBM Formated Study List Entry 00347 DSSHDR_STIME= 121, // Creation time in seconds. 00348 DSSHDR_MSERIES= 123, // Maximum series number created to date 00349 DSSHDR_SERIES= 124, // Bit map for series in study. 00350 DSSHDR_DEFSER= 126, // Default series and iii for the study. 00351 DSSHDR_EOF= 129, // Points to the next block to allocate. 00352 DSSHDR_SDIR= 130, // Series number and sgenid referenced by max 00353 DSSHDR_IMAP= 223, // Image block number map for each series 00354 DSSHDR_RSRV1= 471 // GE NMR Reserved Area 00355 }; 00356 enum DSS_Header_Series_Offsets { 00357 DSSHDR_SERIES_MIMAGE= 0, // Maximum image number created to date. 00358 DSSHDR_SERIES_IMAGE= 1, // Number of images in the series. 00359 DSSHDR_SERIES_RSRV= 2, // Number of images reserved for space. 00360 DSSHDR_SERIES_PTYPE= 3,// Series plane type, AXIAL, SAG ... 00361 DSSHDR_SERIES_PSEQ= 4, // Pulse sequence type. 00362 DSSHDR_SERIES_ANREF= 5, // Anatomical reference, 2 chars. 00363 DSSHDR_SERIES_VANREF= 6, // Vertical Anatomical reference. 00364 DSSHDR_SERIES_FOV= 7, // Field of view. in I*2 mm * 10 00365 DSSHDR_SERIES_DESC= 8, // First 22 chars of series description. 00366 DSSHDR_SERIES_ASTAT= 19, // Archive status. 00367 DSSHDR_SERIES_APEND= 20, // Archive pending status. 00368 DSSHDR_SERIES_IMATRIX= 21, // Image matrix size. 00369 DSSHDR_SERIES_MINLOC= 22, // Minimum location, I*2 mm * 10. 00370 DSSHDR_SERIES_MAXLOC= 23, // Maximim location, I*2 mm * 10. 00371 DSSHDR_SERIES_LOCCHAR= 24, // Characters whcih represent +,- pos. 00372 DSSHDR_SERIES_TLM= 25, // Time the series was last modified. 00373 DSSHDR_SERIES_CHECK= 27, // Checksum for the series header. 00374 DSSHDR_SERIES_DEFIM= 28, // Default image for the series. 00375 DSSHDR_SERIES_TIMAGE= 29, // Total image count (partial & complete 00376 DSSHDR_SERIES_GTYPE= 30, // Gating type if cardiac gated 00377 DSSHDR_SERIES_WPENTRY= 33 // Words per series entry. 00378 }; 00379 enum DSS_Header_Image_Offsets { 00380 DSSHDR_IMAGE_LOCATN= 0, // Image location in I*2 mm * 10 00381 DSSHDR_IMAGE_THICK= 1, // Image thickness in I*2 mm * 10 00382 DSSHDR_IMAGE_NEXT= 2, // Next image by location. 00383 DSSHDR_IMAGE_PRIOR= 3, // Prior image by location. 00384 DSSHDR_IMAGE_EXIST= 4, // None, header or data exists. 00385 DSSHDR_IMAGE_T1= 5, 00386 DSSHDR_IMAGE_T2= 7, 00387 DSSHDR_IMAGE_TRGD= 9, // Trigger Delay 00388 DSSHDR_IMAGE_ECHON= 11, // Echo number 00389 DSSHDR_IMAGE_NXTEN= 12, // Next image by echo number 00390 DSSHDR_IMAGE_PREN= 13, // Prior image by echo number 00391 DSSHDR_IMAGE_GPRE= 14, // Graphically Prescribed flag 00392 DSSHDR_IMAGE_RCC= 15, // R center coordinate 00393 DSSHDR_IMAGE_ACC= 17, // A center coordinate 00394 DSSHDR_IMAGE_SCC= 19, // S center coordinate 00395 DSSHDR_IMAGE_RNC= 21, // R normal coordinate 00396 DSSHDR_IMAGE_ANC= 23, // R normal coordinate 00397 DSSHDR_IMAGE_SNC= 25, // R normal coordinate 00398 DSSHDR_IMAGE_OBP= 27, // Oblique plane 00399 DSSHDR_IMAGE_WPENTRY= 32 00400 }; 00401 enum Block_Offsets { 00402 SYSCON_START = 0*256, 00403 SITCUS_START= 4*256, 00404 STHDR_START= 6*256, 00405 SEHDR_START= 8*256, 00406 IHDR_START= 10*256, 00407 RDBM_START= 12*256, 00408 PSD_START= 16*256, 00409 PIXMAP_START= 26*256, 00410 IDATA_START= 28*256 00411 }; 00412 enum Sys_Config_Offsets { 00413 SCON_SYSID= 6, // System ID String 00414 SCON_HNAME= 16 // Hospital Name 00415 }; 00416 void operator=(const Self&); //purposely not implemented 00417 }; 00419 00420 } // end namespace itk 00421 00422 #endif // __itkGE4ImageIO_h 00423