Home > marsbar > @mardo_2 > mardo_99.m

mardo_99

PURPOSE ^

method to convert SPM2 design to SPM99 design

SYNOPSIS ^

function o = mardo_99(o)

DESCRIPTION ^

 method to convert SPM2 design to SPM99 design
 
 The conversion is crude, and only transfers those fields
 known to be of use in MarsBaR estimation

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function o = mardo_99(o)
0002 % method to convert SPM2 design to SPM99 design
0003 %
0004 % The conversion is crude, and only transfers those fields
0005 % known to be of use in MarsBaR estimation
0006 %
0007 % $Id$
0008   
0009 % Process design
0010 params = paramfields(o);
0011 des = params.des_struct;
0012   
0013 % Transfer images, if present
0014 if isfield(des,'xY') 
0015   des = mars_struct('merge', des, ...
0016             mars_struct('split', des.xY, {'VY', 'RT'})); 
0017   des = rmfield(des, 'xY');
0018 end
0019 
0020 % move names
0021 des.xX.Xnames = des.xX.name;
0022 
0023 % Strip unused fields
0024 des.xX = mars_struct('strip', des.xX, {'W', 'name'});
0025 
0026 % convert sessions (sort of)
0027 if isfield(des, 'Sess')
0028   S = des.Sess;
0029   % get basis function stuff
0030   BFstr = des.xBF.name;
0031   bf = des.xBF.bf;
0032   des.xX.dt = des.xBF.dt;
0033   for s = 1:length(S)
0034     Ss = S(s);
0035     nconds = length(Ss.U);
0036     % Rows, cols
0037     S2{s}.row   = Ss.row;
0038     S2{s}.col   = Ss.col;
0039     % Set basis functions
0040     S2{s}.BFstr = BFstr;
0041     S2{s}.DSstr = 'Variable SOA ';
0042     % Other comparable stuff
0043     for t = 1:nconds
0044       S2{s}.name(t) = Ss.U(t).name;
0045       S2{s}.ons{t}  = Ss.U(t).ons;
0046       S2{s}.pst{t}  = Ss.U(t).pst;
0047       S2{s}.sf{t}   = Ss.U(t).u(33:end,:);
0048       S2{s}.ind{t}  = Ss.Fc(t).i;
0049       S2{s}.bf{t}   = bf;
0050       % Parametric modulation
0051       if Ss.U(t).P.h 
0052     S2{s}.Pname{t} = Ss.U(t).P.name;
0053     S2{s}.Pv{t}    = Ss.U(t).P.P; 
0054       else
0055     S2{s}.Pname{t} = '';
0056     S2{s}.Pv{t}    = [];
0057       end
0058     end
0059     % Not sensibly set stuff
0060     S2{s}.rep = 0;    
0061   end
0062   des.Sess = S2;
0063 end
0064 
0065 % Remove basis function field
0066 des = mars_struct('strip', des, {'xBF'});
0067 
0068 % covariance priors
0069 if isfield(des,'xVi')
0070   fprintf('Removing SPM2 non-sphericity information\n');
0071   rmfield(des,'xVi');
0072 end
0073 
0074 % convert filter structure
0075 if isfield(des.xX, 'K')
0076   K = des.xX.K;
0077   if isstruct(K)
0078     def_filt = struct('RT',0,...
0079               'row',[],...
0080               'LChoice','none',...
0081               'LParam', 0,...
0082               'HChoice','specify',...
0083               'HParam',0);
0084     for k = 1:length(K)
0085       % split off useful fields
0086       K2{k} = mars_struct('splitmerge',K(k),def_filt);
0087     end
0088   elseif K == 1
0089     K2 = eye(size(des.xX,1));
0090   else
0091     K2 = K;
0092   end
0093   des.xX.K = K2;
0094 end
0095 
0096 % Default F contrast field
0097 des.F_iX0 = struct('iX0', [des.xX.iB des.xX.iG], ...
0098            'name', 'effects of interest');
0099 
0100 % Need to identify as SPM99 design
0101 des.SPMid = ['SPM99: Results imported from SPM2 design: ' des.SPMid];
0102 
0103 % put into parent object
0104 params.des_struct = des;
0105 o = mardo_99(params);
0106 
0107 
0108 

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019