0001 function img= ab_tv_diff_solve( inv_model, data1, data2)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 warning('EIDORS:deprecated','AB_TV_DIFF_SOLVE is deprecated as of 06-Jun-2012. Use INV_SOLVE_TV_PDIPM instead.');
0022
0023
0024 p= get_params(inv_model);
0025
0026 dva = calc_difference_data( data1, data2, inv_model.fwd_model);
0027
0028 back_val = get_good_background(inv_model, data1);
0029 inv_model.jacobian_bkgnd.value= back_val;
0030
0031 sol= [];
0032 for i=1:size(dva,2)
0033 [soln,dual_x]=primaldual_tvrecon_lsearch(inv_model, dva(:,i), ...
0034 p.maxiter,p.alpha1,p.alpha2, p.tol, p.beta, p.min_change);
0035
0036 if ~p.keepiters
0037 soln=soln(:,end);
0038 end
0039
0040 sol=[sol, soln];
0041 end
0042
0043 img.name= 'solved by ab_tv_diff_solve';
0044 img.elem_data = sol;
0045 img.fwd_model= inv_model.fwd_model;
0046 try if inv_model.ab_tv_diff_solve.want_dual_variable
0047 img.dual_data = dual_x;
0048 end; end
0049
0050 function p = get_params(inv_model);
0051
0052 try p.alpha1= inv_model.ab_tv_diff_solve.alpha1;
0053 catch p.alpha1= 1e-2;
0054 end
0055
0056 try p.beta= inv_model.ab_tv_diff_solve.beta;
0057 catch p.beta= 1e-4;
0058 end
0059
0060 p.alpha2= calc_hyperparameter( inv_model);
0061
0062 try p.min_change = inv_model.parameters.min_change;
0063 catch p.min_change = 0;
0064 end
0065
0066 try p.maxiter = inv_model.parameters.max_iterations;
0067 catch p.maxiter= 10;
0068 end
0069
0070 try p.keepiters = inv_model.parameters.keep_iterations;
0071 catch p.keepiters= 0;
0072 end
0073
0074 p.tol = 0;
0075
0076 function back_val = get_good_background(inv_mdl, data1);
0077
0078
0079 IM= eidors_obj('image','');
0080 IM.fwd_model= inv_mdl.fwd_model;
0081 s= ones(size(IM.fwd_model.elems,1),1);
0082 IM.elem_data= s;
0083
0084 vsim= fwd_solve( IM);
0085 back_val=abs( data1\vsim.meas );
0086 back_val=1;
0087