fwd_solve

PURPOSE ^

FWD_SOLVE: calculate data from a fwd_model object and an image

SYNOPSIS ^

function data = fwd_solve( fwd_model, img)

DESCRIPTION ^

 FWD_SOLVE: calculate data from a fwd_model object and an image
 
 fwd_solve can be called as
    data= fwd_solve( fwd_model, img)
 or
    data= fwd_solve( img)

 in each case it will call the fwd_model.solve
                        or img.fwd_model.solve method

 For reconstructions on dual meshes, the interpolation matrix
    is defined as fwd_model.coarse2fine. If required, this takes
    coarse2fine * x_coarse = x_fine

 data      is a measurement data structure
 fwd_model is a fwd_model structure
 img       is an img structure

 Options: (not available on all solvers)
    img.fwd_solve.get_all_meas = 1 (data.volt = all FEM nodes, but not CEM)
    img.fwd_solve.get_all_nodes= 1 (data.volt = all nodes, including CEM)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function data = fwd_solve( fwd_model, img)
0002 % FWD_SOLVE: calculate data from a fwd_model object and an image
0003 %
0004 % fwd_solve can be called as
0005 %    data= fwd_solve( fwd_model, img)
0006 % or
0007 %    data= fwd_solve( img)
0008 %
0009 % in each case it will call the fwd_model.solve
0010 %                        or img.fwd_model.solve method
0011 %
0012 % For reconstructions on dual meshes, the interpolation matrix
0013 %    is defined as fwd_model.coarse2fine. If required, this takes
0014 %    coarse2fine * x_coarse = x_fine
0015 %
0016 % data      is a measurement data structure
0017 % fwd_model is a fwd_model structure
0018 % img       is an img structure
0019 %
0020 % Options: (not available on all solvers)
0021 %    img.fwd_solve.get_all_meas = 1 (data.volt = all FEM nodes, but not CEM)
0022 %    img.fwd_solve.get_all_nodes= 1 (data.volt = all nodes, including CEM)
0023 
0024 % (C) 2005 Andy Adler. License: GPL version 2 or version 3
0025 % $Id: fwd_solve.html 2819 2011-09-07 16:43:11Z aadler $
0026 
0027 if nargin==1
0028    img= fwd_model;
0029    fwd_model= img.fwd_model;
0030 end
0031 fwd_model= eidors_model_params( fwd_model );
0032 
0033 if isfield(fwd_model,'coarse2fine')
0034    c2f= fwd_model.coarse2fine;
0035    if size(img.elem_data,1)==size(c2f,2)
0036 %     fwd_model data is provided on coarse mesh
0037       img.elem_data = c2f * img.elem_data; 
0038    end
0039 end
0040 
0041 if isfield(fwd_model,'background')
0042     img.elem_data = img.elem_data + fwd_model.background; 
0043 end
0044 
0045 if ~isfield(fwd_model, 'electrode')
0046    error('EIDORS: attempting to solve on model without electrodes');
0047 end
0048 if ~isfield(fwd_model, 'stimulation')
0049    error('EIDORS: attempting to solve on model without stimulation patterns');
0050 end
0051 
0052 data = feval( fwd_model.solve, fwd_model, img);
0053 data= eidors_obj('data',data);  % create data object
0054 
0055 eidors_obj('set-cache', img, 'fwd_solve_data', data);
0056 eidors_msg('fwd_solve: setting cached value',3);

Generated on Tue 09-Aug-2011 11:38:31 by m2html © 2005