0001 function [ avw ] = avw_hdr_make
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 version = '[$Revision: 1.1 $]';
0030 fprintf('\nAVW_HDR_MAKE [v%s]\n',version(12:16)); tic;
0031
0032
0033
0034
0035
0036
0037
0038 avw.hdr = make_header;
0039
0040 t=toc; fprintf('...done (%5.2f sec).\n',t);
0041
0042 return
0043
0044
0045
0046
0047 function [ hdr ] = make_header
0048
0049 hdr.hk = header_key;
0050 hdr.dime = image_dimension;
0051 hdr.hist = data_history;
0052
0053 return
0054
0055
0056
0057 function [hk] = header_key
0058
0059 hk.sizeof_hdr = int32(348);
0060 hk.data_type(1:10) = sprintf('%10s','');
0061 hk.db_name(1:18) = sprintf('%18s','');
0062 hk.extents = int32(16384);
0063 hk.session_error = int16(0);
0064 hk.regular = sprintf('%1s','r');
0065 hk.hkey_un0 = uint8(0);
0066
0067 return
0068
0069
0070 function [ dime ] = image_dimension
0071
0072 dime.dim(1:8) = int16([4 256 256 256 1 0 0 0]);
0073 dime.vox_units(1:4) = sprintf('%4s','mm');
0074 dime.cal_units(1:8) = sprintf('%8s','');
0075 dime.unused1 = int16(0);
0076 dime.datatype = int16(2);
0077 dime.bitpix = int16(8);
0078 dime.dim_un0 = int16(0);
0079 dime.pixdim(1:8) = single([0 1 1 1 1000 0 0 0]);
0080 dime.vox_offset = single(0);
0081 dime.funused1 = single(0);
0082 dime.funused2 = single(0);
0083
0084 dime.roi_scale = single(1);
0085 dime.cal_max = single(0);
0086 dime.cal_min = single(0);
0087 dime.compressed = int32(0);
0088 dime.verified = int32(0);
0089 dime.glmax = int32(255);
0090 dime.glmin = int32(0);
0091
0092 return
0093
0094
0095 function [ hist ] = data_history
0096
0097 datime = clock;
0098
0099 hist.descrip(1:80) = sprintf('%-80s','mri_toolbox @ http://eeg.sf.net/');
0100 hist.aux_file(1:24) = sprintf('%-24s','');
0101 hist.orient = uint8(0);
0102 hist.originator(1:10) = sprintf('%-10s','');
0103 hist.generated(1:10) = sprintf('%-10s','mri_toolbx');
0104 hist.scannum(1:10) = sprintf('%-10s','');
0105 hist.patient_id(1:10) = sprintf('%-10s','');
0106 hist.exp_date(1:10) = sprintf('%02d-%02d-%04d',datime(3),datime(2),datime(1));
0107 hist.exp_time(1:10) = sprintf('%02d-%02d-%04.1f',datime(4),datime(5),datime(6));
0108 hist.hist_un0(1:3) = sprintf( '%-3s','');
0109 hist.views = int32(0);
0110 hist.vols_added = int32(0);
0111 hist.start_field = int32(0);
0112 hist.field_skip = int32(0);
0113 hist.omax = int32(0);
0114 hist.omin = int32(0);
0115 hist.smax = int32(0);
0116 hist.smin = int32(0);
0117
0118 return