📄 avw_hdr_read.html
字号:
0230 <span class="comment">% char orient; /* 104 + 1 */</span>0231 <span class="comment">% char originator[10]; /* 105 + 10 */</span>0232 <span class="comment">% char generated[10]; /* 115 + 10 */</span>0233 <span class="comment">% char scannum[10]; /* 125 + 10 */</span>0234 <span class="comment">% char patient_id[10]; /* 135 + 10 */</span>0235 <span class="comment">% char exp_date[10]; /* 145 + 10 */</span>0236 <span class="comment">% char exp_time[10]; /* 155 + 10 */</span>0237 <span class="comment">% char hist_un0[3]; /* 165 + 3 */</span>0238 <span class="comment">% int views /* 168 + 4 */</span>0239 <span class="comment">% int vols_added; /* 172 + 4 */</span>0240 <span class="comment">% int start_field; /* 176 + 4 */</span>0241 <span class="comment">% int field_skip; /* 180 + 4 */</span>0242 <span class="comment">% int omax; /* 184 + 4 */</span>0243 <span class="comment">% int omin; /* 188 + 4 */</span>0244 <span class="comment">% int smax; /* 192 + 4 */</span>0245 <span class="comment">% int smin; /* 196 + 4 */</span>0246 <span class="comment">% }; /* total=200 bytes */</span>0247 0248 hist.descrip = fread(fid,80,<span class="string">'*char'</span>)';0249 hist.aux_file = fread(fid,24,<span class="string">'*char'</span>)';0250 hist.orient = fread(fid, 1,<span class="string">'*uint8'</span>); <span class="comment">% see note below on char</span>0251 hist.originator = fread(fid,10,<span class="string">'*char'</span>)';0252 hist.generated = fread(fid,10,<span class="string">'*char'</span>)';0253 hist.scannum = fread(fid,10,<span class="string">'*char'</span>)';0254 hist.patient_id = fread(fid,10,<span class="string">'*char'</span>)';0255 hist.exp_date = fread(fid,10,<span class="string">'*char'</span>)';0256 hist.exp_time = fread(fid,10,<span class="string">'*char'</span>)';0257 hist.hist_un0 = fread(fid, 3,<span class="string">'*char'</span>)';0258 hist.views = fread(fid, 1,<span class="string">'*int32'</span>);0259 hist.vols_added = fread(fid, 1,<span class="string">'*int32'</span>);0260 hist.start_field = fread(fid, 1,<span class="string">'*int32'</span>);0261 hist.field_skip = fread(fid, 1,<span class="string">'*int32'</span>);0262 hist.omax = fread(fid, 1,<span class="string">'*int32'</span>);0263 hist.omin = fread(fid, 1,<span class="string">'*int32'</span>);0264 hist.smax = fread(fid, 1,<span class="string">'*int32'</span>);0265 hist.smin = fread(fid, 1,<span class="string">'*int32'</span>);0266 0267 <span class="comment">% check if hist.orient was saved as ascii char value</span>0268 <span class="keyword">switch</span> hist.orient,0269 <span class="keyword">case</span> 48, hist.orient = uint8(0);0270 <span class="keyword">case</span> 49, hist.orient = uint8(1);0271 <span class="keyword">case</span> 50, hist.orient = uint8(2);0272 <span class="keyword">case</span> 51, hist.orient = uint8(3);0273 <span class="keyword">case</span> 52, hist.orient = uint8(4);0274 <span class="keyword">case</span> 53, hist.orient = uint8(5);0275 <span class="keyword">end</span>0276 0277 <span class="keyword">return</span>0278 0279 0280 <span class="comment">% Note on using char:</span>0281 <span class="comment">% The 'char orient' field in the header is intended to</span>0282 <span class="comment">% hold simply an 8-bit unsigned integer value, not the ASCII representation</span>0283 <span class="comment">% of the character for that value. A single 'char' byte is often used to</span>0284 <span class="comment">% represent an integer value in Analyze if the known value range doesn't</span>0285 <span class="comment">% go beyond 0-255 - saves a byte over a short int, which may not mean</span>0286 <span class="comment">% much in today's computing environments, but given that this format</span>0287 <span class="comment">% has been around since the early 1980's, saving bytes here and there on</span>0288 <span class="comment">% older systems was important! In this case, 'char' simply provides the</span>0289 <span class="comment">% byte of storage - not an indicator of the format for what is stored in</span>0290 <span class="comment">% this byte. Generally speaking, anytime a single 'char' is used, it is</span>0291 <span class="comment">% probably meant to hold an 8-bit integer value, whereas if this has</span>0292 <span class="comment">% been dimensioned as an array, then it is intended to hold an ASCII</span>0293 <span class="comment">% character string, even if that was only a single character.</span>0294 <span class="comment">% Denny <hanson.dennis2@mayo.edu></span>0295 0296 0297 <span class="comment">% Comments</span>0298 <span class="comment">% The header format is flexible and can be extended for new</span>0299 <span class="comment">% user-defined data types. The essential structures of the header</span>0300 <span class="comment">% are the header_key and the image_dimension.</span>0301 <span class="comment">%</span>0302 0303 <span class="comment">% The required elements in the header_key substructure are:</span>0304 <span class="comment">%</span>0305 <span class="comment">% int sizeof_header Must indicate the byte size of the header file.</span>0306 <span class="comment">% int extents Should be 16384, the image file is created as</span>0307 <span class="comment">% contiguous with a minimum extent size.</span>0308 <span class="comment">% char regular Must be 'r' to indicate that all images and</span>0309 <span class="comment">% volumes are the same size.</span>0310 <span class="comment">%</span>0311 0312 <span class="comment">% The image_dimension substructure describes the organization and</span>0313 <span class="comment">% size of the images. These elements enable the database to reference</span>0314 <span class="comment">% images by volume and slice number. Explanation of each element follows:</span>0315 <span class="comment">%</span>0316 <span class="comment">% short int dim[ ]; /* Array of the image dimensions */</span>0317 <span class="comment">%</span>0318 <span class="comment">% dim[0] Number of dimensions in database; usually 4.</span>0319 <span class="comment">% dim[1] Image X dimension; number of pixels in an image row.</span>0320 <span class="comment">% dim[2] Image Y dimension; number of pixel rows in slice.</span>0321 <span class="comment">% dim[3] Volume Z dimension; number of slices in a volume.</span>0322 <span class="comment">% dim[4] Time points; number of volumes in database.</span>0323 <span class="comment">% dim[5] Undocumented.</span>0324 <span class="comment">% dim[6] Undocumented.</span>0325 <span class="comment">% dim[7] Undocumented.</span>0326 <span class="comment">%</span>0327 <span class="comment">% char vox_units[4] Specifies the spatial units of measure for a voxel.</span>0328 <span class="comment">% char cal_units[8] Specifies the name of the calibration unit.</span>0329 <span class="comment">% short int unused1 /* Unused */</span>0330 <span class="comment">% short int datatype /* Datatype for this image set */</span>0331 <span class="comment">% /*Acceptable values for datatype are*/</span>0332 <span class="comment">% #define DT_NONE 0</span>0333 <span class="comment">% #define DT_UNKNOWN 0 /*Unknown data type*/</span>0334 <span class="comment">% #define DT_BINARY 1 /*Binary ( 1 bit per voxel)*/</span>0335 <span class="comment">% #define DT_UNSIGNED_CHAR 2 /*Unsigned character ( 8 bits per voxel)*/</span>0336 <span class="comment">% #define DT_SIGNED_SHORT 4 /*Signed short (16 bits per voxel)*/</span>0337 <span class="comment">% #define DT_SIGNED_INT 8 /*Signed integer (32 bits per voxel)*/</span>0338 <span class="comment">% #define DT_FLOAT 16 /*Floating point (32 bits per voxel)*/</span>0339 <span class="comment">% #define DT_COMPLEX 32 /*Complex (64 bits per voxel; 2 floating point numbers)/*</span>0340 <span class="comment">% #define DT_DOUBLE 64 /*Double precision (64 bits per voxel)*/</span>0341 <span class="comment">% #define DT_RGB 128 /*A Red-Green-Blue datatype*/</span>0342 <span class="comment">% #define DT_ALL 255 /*Undocumented*/</span>0343 <span class="comment">%</span>0344 <span class="comment">% short int bitpix; /* Number of bits per pixel; 1, 8, 16, 32, or 64. */</span>0345 <span class="comment">% short int dim_un0; /* Unused */</span>0346 <span class="comment">%</span>0347 <span class="comment">% float pixdim[]; Parallel array to dim[], giving real world measurements in mm and ms.</span>0348 <span class="comment">% pixdim[0]; Pixel dimensions?</span>0349 <span class="comment">% pixdim[1]; Voxel width in mm.</span>0350 <span class="comment">% pixdim[2]; Voxel height in mm.</span>0351 <span class="comment">% pixdim[3]; Slice thickness in mm.</span>0352 <span class="comment">% pixdim[4]; timeslice in ms (ie, TR in fMRI).</span>0353 <span class="comment">% pixdim[5]; Undocumented.</span>0354 <span class="comment">% pixdim[6]; Undocumented.</span>0355 <span class="comment">% pixdim[7]; Undocumented.</span>0356 <span class="comment">%</span>0357 <span class="comment">% float vox_offset; Byte offset in the .img file at which voxels start. This value can be</span>0358 <span class="comment">% negative to specify that the absolute value is applied for every image</span>0359 <span class="comment">% in the file.</span>0360 <span class="comment">%</span>0361 <span class="comment">% float roi_scale; Specifies the Region Of Interest scale?</span>0362 <span class="comment">% float funused1; Undocumented.</span>0363 <span class="comment">% float funused2; Undocumented.</span>0364 <span class="comment">%</span>0365 <span class="comment">% float cal_max; Specifies the upper bound of the range of calibration values.</span>0366 <span class="comment">% float cal_min; Specifies the lower bound of the range of calibration values.</span>0367 <span class="comment">%</span>0368 <span class="comment">% int compressed; Undocumented.</span>0369 <span class="comment">% int verified; Undocumented.</span>0370 <span class="comment">%</span>0371 <span class="comment">% int glmax; The maximum pixel value for the entire database.</span>0372 <span class="comment">% int glmin; The minimum pixel value for the entire database.</span>0373 <span class="comment">%</span>0374 <span class="comment">%</span></pre></div><hr><address>Generated on Fri 21-May-2004 12:38:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -