0001 function img=ab_tv_lagged_diff( inv_model, data1, data2)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 warning('EIDORS:deprecated','AB_TV_LAGGED_DIFF is deprecated as of 06-Jun-2012. Use INV_SOLVE_TV_IRLS instead.');
0020 try max_iter = inv_model.parameters.max_iterations;
0021 catch max_iter = 10;
0022 end
0023
0024 try min_change = inv_model.parameters.min_change;
0025 catch min_change = 0;
0026 end
0027
0028 try beta = inv_model.aa_tv_lagged_diff.beta;
0029 catch beta = 1e-3;
0030 end
0031
0032
0033 fwd_model= inv_model.fwd_model;
0034 d=calc_difference_data( data1, data2, inv_model.fwd_model);
0035
0036 L=calc_R_prior( inv_model );
0037
0038 img_bkgnd=calc_jacobian_bkgnd( inv_model );
0039 J=calc_jacobian( fwd_model, img_bkgnd);
0040
0041 alpha=calc_hyperparameter( inv_model );
0042
0043
0044 delta_sigma = zeros(size(J,2),1);
0045
0046 Obj_Fcn = inf;
0047
0048 for k=1:max_iter
0049
0050 dv = J*delta_sigma - d;
0051
0052
0053 Obj_Fcnk = norm(dv)^2 + alpha*sum(abs( delta_sigma ));
0054 delta_ObjFcn = abs(Obj_Fcnk/Obj_Fcn - 1);
0055
0056 if delta_ObjFcn < min_change;
0057 eidors_msg('Lagged_diff: Breaking at iteration %d',k,2);
0058 break;
0059 end
0060 Obj_Fcn = Obj_Fcnk;
0061
0062 E= sqrt((L*delta_sigma).^2+beta);
0063 inv_E= spdiags( 1./E, 0, length(E), length(E));
0064
0065 phi1=J'*dv+ alpha*L'*inv_E*L*delta_sigma;
0066 phi2=J'*J + alpha*L'*inv_E*L;
0067
0068 upd=-(phi2)\phi1;
0069
0070 delta_sigma=delta_sigma+upd;
0071
0072
0073 end
0074
0075
0076 img.name = 'ab_tv_lagged_diff';
0077 img.elem_data = delta_sigma;
0078 img.fwd_model = fwd_model;