Doxygen Source Code Documentation
ge4_header.h
Go to the documentation of this file.00001 00002 /* ------------------------------------------------------------ */ 00003 /* GE MR Signa 4.x header type : GEMS 46-021858 */ 00004 00005 #define GE4_HEADER_LENGTH 0x03800 /* 28 x 256 x 2 ( 28 blocks) */ 00006 #define GE4_IMAGE_SIZE 0x20000 /* 256 x 256 x 2 (256 blocks) */ 00007 00008 /* ---- display constants ---- */ 00009 00010 #define GE4_DISP_NONE 0x00 00011 #define GE4_DISP_IMAGE 0x01 00012 #define GE4_DISP_SERIES 0x02 00013 #define GE4_DISP_STUDY 0x04 00014 #define GE4_DISP_ALL 0xff 00015 00016 /* ---- string constants ---- */ 00017 00018 #define GE4_IMAGE_TITLE "IMAGE HEADER 04" 00019 #define GE4_SERIES_TITLE "SERIES HEADER 04" 00020 #define GE4_STUDY_TITLE "STUDY HEADER 04" 00021 00022 /* ---- series header field offsets (base + 2 * word_num) ---- */ 00023 00024 #define GE4_OFF_SER_TITLE 0x1000 /* = (0x1000) */ 00025 #define GE4_OFF_SER_SERIES_NUM 0x103e /* = (0x1000 + 2 * 031) */ 00026 #define GE4_OFF_SER_PLANE_TYPE 0x1114 /* = (0x1000 + 2 * 138) */ 00027 #define GE4_OFF_SER_PLANE_DESC 0x1116 /* = (0x1000 + 2 * 139) */ 00028 #define GE4_OFF_SER_IM_MODE 0x1126 /* = (0x1000 + 2 * 147) */ 00029 #define GE4_OFF_SER_PULSE_SEQ 0x112a /* = (0x1000 + 2 * 149) */ 00030 #define GE4_OFF_SER_FOV 0x112e /* = (0x1000 + 2 * 151) */ 00031 #define GE4_OFF_SER_CENTER 0x1132 /* = (0x1000 + 2 * 153) */ 00032 #define GE4_OFF_SER_ORIENT 0x113e /* = (0x1000 + 2 * 159) */ 00033 #define GE4_OFF_SER_SCAN_MAT_X 0x118e /* = (0x1000 + 2 * 199) */ 00034 #define GE4_OFF_SER_SCAN_MAT_Y 0x1190 /* = (0x1000 + 2 * 200) */ 00035 #define GE4_OFF_SER_IM_MAT 0x1192 /* = (0x1000 + 2 * 201) */ 00036 00037 /* ---- string lengths ---- */ 00038 00039 #define GE4_L_SER_TITLE 16 00040 #define GE4_L_SER_SER_NUM 3 00041 #define GE4_L_SER_PL_DESC 12 00042 00043 /* ---- image header field offsets (base + 2 * word_num) ---- */ 00044 00045 #define GE4_OFF_IMG_TITLE 0x1400 00046 #define GE4_OFF_IMG_IM_NUM 0x1458 /* = (0x1400 + 2 * 044) */ 00047 #define GE4_OFF_IMG_IM_LOCN 0x1492 /* = (0x1400 + 2 * 073) */ 00048 #define GE4_OFF_IMG_TABLE_POSN 0x1496 /* = (0x1400 + 2 * 075) */ 00049 #define GE4_OFF_IMG_IM_THICK 0x149a /* = (0x1400 + 2 * 077) */ 00050 #define GE4_OFF_IMG_IM_SPACING 0x149e /* = (0x1400 + 2 * 079) */ 00051 #define GE4_OFF_IMG_TR 0x14a4 /* = (0x1400 + 2 * 082) */ 00052 #define GE4_OFF_IMG_TE 0x14ac /* = (0x1400 + 2 * 086) */ 00053 #define GE4_OFF_IMG_TI 0x14b0 /* = (0x1400 + 2 * 088) */ 00054 #define GE4_OFF_IMG_NUM_ECHOS 0x14c4 /* = (0x1400 + 2 * 098) */ 00055 #define GE4_OFF_IMG_ECHO_NUM 0x14c6 /* = (0x1400 + 2 * 099) */ 00056 #define GE4_OFF_IMG_NEX_INT 0x14ca /* = (0x1400 + 2 * 101) */ 00057 #define GE4_OFF_IMG_NEX_REAL 0x1524 /* = (0x1400 + 2 * 146) */ 00058 #define GE4_OFF_IMG_FLIP_ANGLE 0x155e /* = (0x1400 + 2 * 175) */ 00059 00060 /* ---- image header field lengths ---- */ 00061 00062 #define GE4_L_IM_TITLE 16 00063 #define GE4_L_IM_NUM 3 00064 00065 /* ---- study header field offsets (base + 2 * word_num) ---- */ 00066 00067 #define GE4_OFF_STDY_TITLE 0x0c00 00068 #define GE4_OFF_STDY_NUM 0x0c40 /* = (0x0c00 + 2 * 032) */ 00069 #define GE4_OFF_STDY_DATE 0x0c4e /* = (0x0c00 + 2 * 039) */ 00070 #define GE4_OFF_STDY_TIME 0x0c5e /* = (0x0c00 + 2 * 047) */ 00071 #define GE4_OFF_STDY_PAT_NAME 0x0c6c /* = (0x0c00 + 2 * 054) */ 00072 #define GE4_OFF_STDY_PAT_ID 0x0c8c /* = (0x0c00 + 2 * 070) */ 00073 #define GE4_OFF_STDY_AGE 0x0c9c /* = (0x0c00 + 2 * 078) */ 00074 #define GE4_OFF_STDY_SEX 0x0ca0 /* = (0x0c00 + 2 * 080) */ 00075 00076 /* ---- study header field lengths ---- */ 00077 00078 #define GE4_L_STDY_TITLE 16 00079 #define GE4_L_STDY_NUM 5 00080 #define GE4_L_STDY_DATE 9 00081 #define GE4_L_STDY_TIME 8 00082 #define GE4_L_STDY_PAT_NAME 32 00083 #define GE4_L_STDY_PAT_ID 12 00084 #define GE4_L_STDY_AGE 3 00085 00086 /* ---------------------------------------------------------------------- */ 00087 00088 /* ---- actual data structures ---- */ 00089 typedef struct 00090 { 00091 char title [GE4_L_STDY_TITLE + 1]; 00092 char num [GE4_L_STDY_NUM + 1]; 00093 char date [GE4_L_STDY_DATE + 1]; 00094 char time [GE4_L_STDY_TIME + 1]; 00095 char pat_name [GE4_L_STDY_PAT_NAME + 1]; 00096 char pat_id [GE4_L_STDY_PAT_ID + 1]; 00097 char age [GE4_L_STDY_AGE + 1]; 00098 char sex; 00099 } ge4_study_t; 00100 00101 typedef struct 00102 { 00103 char title [GE4_L_SER_TITLE+1]; /* words 000-015 */ 00104 char series_num[GE4_L_SER_SER_NUM+1]; /* word 031 */ 00105 short plane_type; /* word 138 */ 00106 char plane_desc[GE4_L_SER_PL_DESC+1]; /* word 139 */ 00107 short im_mode; /* word 147 */ 00108 short pulse_seq; /* word 149 */ 00109 float fov; /* words 151,152 */ 00110 float center[3]; /* words 153-158 */ 00111 short orient; /* word 159 */ 00112 short scan_mat_x; /* word 199 */ 00113 short scan_mat_y; /* word 200 */ 00114 short im_mat; /* word 201 */ 00115 } ge4_series_t; 00116 00117 typedef struct 00118 { 00119 char title [GE4_L_IM_TITLE+1]; /* word 000 */ 00120 char im_num[GE4_L_IM_NUM+1]; /* words 044-046 */ 00121 float im_loc; /* words 073,074 */ 00122 float table_posn; /* words 075,076 */ 00123 float im_thickness; /* words 077,078 */ 00124 float im_spacing; /* words 079,080 */ 00125 float tr; /* uS */ /* words 082,083 */ 00126 float te; /* uS */ /* words 082,083 */ 00127 float ti; /* uS */ /* words 082,083 */ 00128 short num_echoes; /* word 098 */ 00129 short echo_num; /* word 099 */ 00130 short iNEX; /* word 101 */ 00131 float fNEX; /* words 146,147 */ 00132 short flip_angle; /* word 175 */ 00133 } ge4_image_t; 00134 00135 typedef struct 00136 { 00137 ge4_study_t std_h; /* series header data */ 00138 ge4_series_t ser_h; /* series header data */ 00139 ge4_image_t im_h; /* image header data */ 00140 short * image; /* image data, if non-NULL */ 00141 int im_bytes; /* size of image, in bytes */ 00142 int swap; /* was the data swapped? */ 00143 } ge4_header; 00144 00145 00146 /* global prototypes */ 00147 int ge4_read_header ( ge4_header * H, char * filename, int get_image ); 00148 int idisp_ge4_image_header ( char * info, ge4_image_t * im ); 00149 int idisp_ge4_series_header ( char * info, ge4_series_t * s ); 00150 int idisp_ge4_study_header ( char * info, ge4_study_t * st ); 00151 00152 00153 int ge4_swap_all_bytes ( ge4_header * h ); 00154 int idisp_ge4_series_header ( char * info, ge4_series_t * s ); 00155 int ge4_validate_header ( ge4_header * h ); 00156 00157 /* ---------------------------------------------------------------------- */ 00158 00159 #define GE4M_IND2STR(ind,str_list) \ 00160 ( ind < 0 || (ind > (sizeof(str_list)/sizeof(char *))) ) ? \ 00161 "out-of-range" : str_list[ind] 00162