Home > rest_20090422 > rest_spm5_files > @read_nifti > private > mayostruc.m

mayostruc

PURPOSE ^

Create a data structure describing Analyze headers

SYNOPSIS ^

function o = mayostruc

DESCRIPTION ^

 Create a data structure describing Analyze headers
 _______________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

mayostruc.m

SOURCE CODE ^

0001 function o = mayostruc
0002 % Create a data structure describing Analyze headers
0003 % _______________________________________________________________________
0004 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0005 
0006 %
0007 % $Id: mayostruc.m 253 2005-10-13 15:31:34Z guillaume $
0008 
0009 
0010 persistent org;
0011 if ~isempty(org),
0012     o = org;
0013     return;
0014 end;
0015 t = struct('conv',{ @char, @int16, @int32, @single },...
0016            'prec',{'uint8','int16','int32','single'},...
0017            'size',{      1,      2,      4,       4});
0018 c = t(1);
0019 s = t(2);
0020 i = t(3);
0021 f = t(4);
0022 table = {...
0023     i, 1,'sizeof_hdr',348
0024     c,10,'data_type',[]
0025     c,18,'db_name',[]
0026     i, 1,'extents',[]
0027     s, 1,'session_error',[]
0028     c, 1,'regular','r'
0029     c, 1,'hkey_un0',[]
0030     s, 8,'dim',[3 1 1 1  1 1 1 1 1]
0031     c, 4,'vox_units',[]
0032     c, 8,'cal_units',[]
0033     s, 1,'unused1',[]
0034     s, 1,'datatype',[]
0035     s, 1,'bitpix',[]
0036     s, 1,'dim_un0',[]
0037     f, 8,'pixdim',[]
0038     f, 1,'vox_offset',0
0039     f, 1,'roi_scale',1
0040     f, 1,'funused1',0
0041     f, 1,'funused2',[]
0042     f, 1,'cal_max',[]
0043     f, 1,'cal_min',[]
0044     i, 1,'compressed',[]
0045     i, 1,'verified',[]
0046     i, 1,'glmax',[]
0047     i, 1,'glmin',[]
0048     c,80,'descrip','Analyze Image'
0049     c,24,'aux_file',''
0050     c, 1,'orient',[]
0051 %    c,10,'originator',[]
0052     s, 5,'origin',[] % SPM version
0053     c,10,'generated',[]
0054     c,10,'scannum',[]
0055     c,10,'patient_id',[]
0056     c,10,'exp_date',[]
0057     c,10,'exp_time',[]
0058     c, 3,'hist_un0',[]
0059     i, 1,'views',[]
0060     i, 1,'vols_added',[]
0061     i, 1,'start_field',[]
0062     i, 1,'field_skip',[]
0063     i, 1,'omax',[]
0064     i, 1,'omin',[]
0065     i, 1,'smax',[]
0066     i, 1,'smin',[]};
0067 org = struct('label',table(:,3),'dtype',table(:,1),'len',table(:,2),...
0068     'offset',0,'def',table(:,4));
0069 os  = 0;
0070 for j=1:length(org)
0071     os  = os + org(j).dtype.size*ceil(os/org(j).dtype.size);
0072     fun = org(j).dtype.conv;
0073     def = [org(j).def zeros(1,org(j).len-length(org(j).def))];
0074     org(j).def    = feval(fun,def);
0075     org(j).offset = os;
0076     os  = os + org(j).len*org(j).dtype.size;
0077 end;
0078 o = org;
0079 return;
0080

Generated on Wed 29-Apr-2009 01:06:38 by m2html © 2005