Home > phiwave > @phido > estimate.m

estimate

PURPOSE ^

estimate method - estimates phiwave GLM for SPM model

SYNOPSIS ^

function [phiwD] = estimate(phiwD, VY, params)

DESCRIPTION ^

 estimate method - estimates phiwave GLM for SPM model

 phiwD           - SPM design object
 VY              - Images to estimate on (default - from design)
 params          - structure containing options as fields; [defaults]
                   'wavelet'    - phiwave wavelet object to transform
                      images [phiw_lemarie(2)] 
                   'scales'     - scales for wavelet transform [4]
                   'wtprefix'   - prefix for wavelet transformed files
                      ['wv_']
                   'maskthresh' - threshold for mask image [0.05]
                   'write_res'  - flag, if not 0, writes residual images

 e.g.
 % Estimate using images from design, lemarie wavelet
 params = struct('scales', 4, 'wavelet', phiw_lemarie(2), ...
                 'wtprefix', 'wt_', 'maskthresh', 0.05, ...
                 'write_res', 1); 
 pE = estimate(pD, [], params);
 
 $Id: estimate.m,v 1.5 2005/05/31 00:51:26 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [phiwD] = estimate(phiwD, VY, params)
0002 % estimate method - estimates phiwave GLM for SPM model
0003 %
0004 % phiwD           - SPM design object
0005 % VY              - Images to estimate on (default - from design)
0006 % params          - structure containing options as fields; [defaults]
0007 %                   'wavelet'    - phiwave wavelet object to transform
0008 %                      images [phiw_lemarie(2)]
0009 %                   'scales'     - scales for wavelet transform [4]
0010 %                   'wtprefix'   - prefix for wavelet transformed files
0011 %                      ['wv_']
0012 %                   'maskthresh' - threshold for mask image [0.05]
0013 %                   'write_res'  - flag, if not 0, writes residual images
0014 %
0015 % e.g.
0016 % % Estimate using images from design, lemarie wavelet
0017 % params = struct('scales', 4, 'wavelet', phiw_lemarie(2), ...
0018 %                 'wtprefix', 'wt_', 'maskthresh', 0.05, ...
0019 %                 'write_res', 1);
0020 % pE = estimate(pD, [], params);
0021 %
0022 % $Id: estimate.m,v 1.5 2005/05/31 00:51:26 matthewbrett Exp $
0023 
0024 % Default parameters
0025 defparams = struct('wavelet',  phiw_lemarie(2), ...
0026            'scales',   4, ...
0027            'wtprefix', 'wv_', ...
0028            'maskthresh', 0.05, ...
0029            'write_res', 1);
0030 
0031 if nargin < 2
0032   VY = [];
0033 end
0034 if nargin < 3
0035   params = [];
0036 end
0037 
0038 % Images not passed, use images in design
0039 if isempty(VY)
0040   if ~has_images(phiwD)
0041     error('Need data in design or passed as argument');
0042   end
0043   VY = get_images(phiwD);
0044 else
0045   % Images passed, check and put in design
0046   if size(VY, 1) == 1, VY = VY'; end
0047   if size(VY, 1) ~= n_time_points(phiwD)
0048     error('The data and design must have the same number of rows');
0049   end
0050   phiwD = set_images(phiwD, VY);
0051 end
0052 
0053 % check design is complete
0054 if ~can_phiw_estimate(phiwD)
0055   error('This design needs more information before it can be estimated');
0056 end
0057 
0058 % if images in design are wt'ed, get default from there
0059 if phiw_wvimg('is_wted', VY(1))
0060   defparams  = mars_struct('ffillsplit', defparams,  ...
0061                phiw_wvimg('wtinfo', VY(1)));
0062 end
0063 params = mars_struct('ffillsplit', defparams, params);
0064 
0065 % check if files are already WT'ed, do WT if not
0066 phiwD = vox2wt_ana(phiwD, params);
0067 
0068 % Do estimation
0069 phiwD = estimate_wted(phiwD, params);
0070 
0071 % Put params into design structure
0072 SPM = des_struct(phiwD);
0073 SPM.xPhi = mars_struct('fillafromb', SPM.xPhi, params);
0074 phiwD = des_struct(phiwD, SPM);

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003