aa_fwd_solve

PURPOSE ^

AA_FWD_SOLVE: data= aa_fwd_solve( fwd_model, img)

SYNOPSIS ^

function data =aa_fwd_solve(fwd_model, img)

DESCRIPTION ^

 AA_FWD_SOLVE: data= aa_fwd_solve( fwd_model, img)
 Fwd solver for Andy Adler's EIT code
 Input:
    fwd_model = forward model
    img       = image struct
 Output:
    data = measurements struct
 Options: (to return internal FEM information)
    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 =aa_fwd_solve(fwd_model, img)
0002 % AA_FWD_SOLVE: data= aa_fwd_solve( fwd_model, img)
0003 % Fwd solver for Andy Adler's EIT code
0004 % Input:
0005 %    fwd_model = forward model
0006 %    img       = image struct
0007 % Output:
0008 %    data = measurements struct
0009 % Options: (to return internal FEM information)
0010 %    img.fwd_solve.get_all_meas = 1 (data.volt = all FEM nodes, but not CEM)
0011 %    img.fwd_solve.get_all_nodes= 1 (data.volt = all nodes, including CEM)
0012 
0013 % (C) 1995-2002 Andy Adler. License: GPL version 2 or version 3
0014 % Ref: Adler & Guardo (1996) IEEE T. Med Imaging
0015 % $Id: aa_fwd_solve.html 2819 2011-09-07 16:43:11Z aadler $
0016 
0017 % correct input paralemeters if function was called with only img
0018 if nargin==1 && strcmp(fwd_model.type, 'image');
0019     img = fwd_model;
0020     fwd_model= img.fwd_model;
0021 end
0022 
0023 pp= aa_fwd_parameters( fwd_model );
0024 s_mat= calc_system_mat( fwd_model, img );
0025 
0026 idx= 1:size(s_mat.E,1);
0027 idx( fwd_model.gnd_node ) = [];
0028 
0029 v= zeros(pp.n_node,pp.n_stim);
0030 
0031 tol= 1e-5;
0032 v(idx,:)= forward_solver( s_mat.E(idx,idx), pp.QQ(idx,:), tol);
0033 
0034 % calc voltage on electrodes
0035 v_els= pp.N2E * v;
0036 
0037 % measured voltages from v
0038 vv = zeros( pp.n_meas, 1 );
0039 idx=0;
0040 for i=1:pp.n_stim
0041    meas_pat= fwd_model.stimulation(i).meas_pattern;
0042    n_meas  = size(meas_pat,1);
0043    vv( idx+(1:n_meas) ) = meas_pat*v_els(:,i);
0044    idx= idx+ n_meas;
0045 end
0046 
0047 
0048 % create a data structure to return
0049 data.meas= vv;
0050 data.time= -1; % unknown
0051 data.name= 'solved by aa_fwd_solve';
0052 try; if img.fwd_solve.get_all_meas == 1
0053    data.volt = v(1:pp.n_node,:); % but not on CEM nodes
0054 end; end
0055 try; if img.fwd_solve.get_all_nodes== 1
0056    data.volt = v;                % all, including CEM nodes
0057 end; end

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