Home > marsbar > @mardo > set_vol_field.m

set_vol_field

PURPOSE ^

method to set named field, containing or referring to vol structs

SYNOPSIS ^

function D = set_vol_field(D, fieldn, imgs)

DESCRIPTION ^

 method to set named field, containing or referring to vol structs
 FORMAT D = get_vol_field(D, fieldn, imgs)
 
 D        - design object
 fieldn   - field name
 imgs     - image names or vol structs
  
 Returns
 D        - changed object

 e.g D = get_vol_field(D, 'Vbeta', Vbeta);
 
 We need to deal with the fact that vol fields can be char or vol_structs.
 SPM99, for good reason, stored the design structs from the results of the
 estimation as file names, which then had to be remapped with spm_vol to
 get the vol structs.  The good reason was that this avoided
 byte-swapping problems if the design was copied to another system.
 
 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function D = set_vol_field(D, fieldn, imgs)
0002 % method to set named field, containing or referring to vol structs
0003 % FORMAT D = get_vol_field(D, fieldn, imgs)
0004 %
0005 % D        - design object
0006 % fieldn   - field name
0007 % imgs     - image names or vol structs
0008 %
0009 % Returns
0010 % D        - changed object
0011 %
0012 % e.g D = get_vol_field(D, 'Vbeta', Vbeta);
0013 %
0014 % We need to deal with the fact that vol fields can be char or vol_structs.
0015 % SPM99, for good reason, stored the design structs from the results of the
0016 % estimation as file names, which then had to be remapped with spm_vol to
0017 % get the vol structs.  The good reason was that this avoided
0018 % byte-swapping problems if the design was copied to another system.
0019 %
0020 % $Id$
0021 
0022 if nargin < 2
0023   error('Need field name');
0024 end
0025 
0026 SPM = des_struct(D);
0027 
0028 V = design_vol(D, imgs);
0029 
0030 SPM = setfield(SPM, fieldn, V);
0031 D = des_struct(D, SPM);

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