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
0018
0019 if ischar(inv_model) && strcmp(inv_model,'UNIT_TEST'), do_unit_test, return, end;
0020
0021 hp = calc_hyperparameter(inv_model);
0022 inv_model.solve_use_matrix.RM = calc_TSVD_RM(inv_model, hp);
0023 sol = solve_use_matrix(inv_model,data1,data2);
0024
0025
0026 function do_unit_test
0027
0028 mdl = mk_common_model('c3cr',16);fmdl = mdl.fwd_model; clear mdl;
0029
0030 img = mk_image(fmdl,1);
0031 vh = fwd_solve(img);
0032
0033 str = sprintf('(x - %f).^2+(y - %f).^2+(z - %f).^2<%f^2',[-0.3 0.2 0 0.1]);
0034 select_fcn = inline(str,'x','y','z');
0035 e = elem_select(img.fwd_model, select_fcn);
0036 ind = find(e);
0037 img.elem_data(ind) = img.elem_data(ind) - 0.25*e(ind);
0038 vi = fwd_solve(img);
0039
0040
0041 imdl.name= 'Test TSVD model';
0042 imdl.type= 'inv_model';
0043 imdl.solve= @inv_solve_TSVD;
0044 imdl.hyperparameter.value = 1;
0045 imdl.jacobian_bkgnd.value = 1;
0046 imdl.reconst_type= 'difference';
0047 imdl.fwd_model = fmdl;
0048
0049
0050 subplot(221);
0051 show_slices(img,[inf,inf,0]);
0052 subplot(222);
0053 rimg = inv_solve(imdl, vh, vi);
0054 show_slices(rimg,[inf,inf,0]);
0055
0056 subplot(223);
0057 imdl.hyperparameter.value = .1;
0058 rimg = inv_solve(imdl, vh, vi);
0059 show_slices(rimg,[inf,inf,0]);