Home > marsbar > @mardo_2 > convert_vols.m

convert_vols

PURPOSE ^

method that converts vol structs in design and converts to format 'ver'

SYNOPSIS ^

function o = convert_vols(o, ver)

DESCRIPTION ^

 method that converts vol structs in design and converts to format 'ver'
 FORMAT o = convert_fo(o, ver)
 
 Input
 o        - design object
 ver      - optional version for vols from '99' or '5'
            Defaults to version for current SPM version

 Output
 o        - object with converted vols
 
 Example
 % Convert vols to current format
 o = convert_vols(o);
 
 % Convert to native format for SPM99 designs
 o = convert_vols(o, native_vol_ver(o));
 
 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function o = convert_vols(o, ver)
0002 % method that converts vol structs in design and converts to format 'ver'
0003 % FORMAT o = convert_fo(o, ver)
0004 %
0005 % Input
0006 % o        - design object
0007 % ver      - optional version for vols from '99' or '5'
0008 %            Defaults to version for current SPM version
0009 %
0010 % Output
0011 % o        - object with converted vols
0012 %
0013 % Example
0014 % % Convert vols to current format
0015 % o = convert_vols(o);
0016 %
0017 % % Convert to native format for SPM99 designs
0018 % o = convert_vols(o, native_vol_ver(o));
0019 %
0020 % $Id$
0021 
0022 if nargin < 2
0023   ver = mars_vol_utils('current_ver');
0024 end
0025 
0026 SPM = des_struct(o);
0027 SPM = sf_conv(SPM, ver, 'xY', 'VY');
0028 SPM = sf_conv(SPM, ver, 'xM', 'VM');
0029 SPM = sf_conv(SPM, ver, 'xVol', 'VRpv');
0030 SPM = sf_conv(SPM, ver, 'Vbeta');
0031 SPM = sf_conv(SPM, ver, 'VResMS');
0032 SPM = sf_conv(SPM, ver, 'VM');
0033 o = des_struct(o, SPM);
0034 
0035 xCon = get_contrasts(o);
0036 if ~isempty(xCon)
0037   for i = 1:length(xCon)
0038     xCon(i) = sf_conv(xCon(i), ver, 'Vcon');
0039     xCon(i) = sf_conv(xCon(i), ver, 'Vspm');
0040   end
0041 end
0042 o = set_contrasts(o, xCon, 0);
0043 return
0044 
0045 function S = sf_conv(S, ver, varargin)
0046 V = mars_struct('getifthere', S, varargin{:});
0047 if ~isempty(V)
0048   V = mars_vol_utils('convert', V, ver);
0049   S = setfield(S, varargin{:}, V);
0050 end
0051 return

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