0001 function sol = inv_solve_TSVD(inv_model, data1, data2)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 if isstr(inv_model) && strcmp(inv_model,'UNIT_TEST'), do_unit_test, return, end;
0018
0019 hp = calc_hyperparameter(inv_model);
0020 inv_model.solve_use_matrix.RM = calc_TSVD_RM(inv_model, hp);
0021 sol = solve_use_matrix(inv_model,data1,data2);
0022
0023
0024 function do_unit_test
0025
0026 mdl = mk_common_model('c3cr',16);fmdl = mdl.fwd_model; clear mdl;
0027
0028 img = mk_image(fmdl,1);
0029 vh = fwd_solve(img);
0030
0031 str = sprintf('(x-%f).^2+(y-%f).^2+(z-%f).^2<%f^2',[-0.3 0.2 0 0.1]);
0032 select_fcn = inline(str,'x','y','z');
0033 e = elem_select(img.fwd_model, select_fcn);
0034 ind = find(e);
0035 img.elem_data(ind) = img.elem_data(ind) - 0.25*e(ind);
0036 vi = fwd_solve(img);
0037
0038
0039 imdl.name= 'Test TSVD model';
0040 imdl.type= 'inv_model';
0041 imdl.solve= @inv_solve_TSVD;
0042 imdl.hyperparameter.value = 1;
0043 imdl.jacobian_bkgnd.value = 1;
0044 imdl.reconst_type= 'difference';
0045 imdl.fwd_model = fmdl;
0046
0047
0048 rimg = inv_solve(imdl, vh, vi);
0049 show_slices(rimg,[inf,inf,0]);