get_RM

PURPOSE ^

% GET_RM: obtains the reconstruction matrix from a given inverse model

SYNOPSIS ^

function [RM, J, RtR, W, Jfine] = get_RM(inv_model)

DESCRIPTION ^

% GET_RM: obtains the reconstruction matrix from a given inverse model
   [RM, J, RtR, W, Jfine] = get_RM(inv_model)

 Output: 
   RM          - reconstruction matrix
   J           - Jacobian matrix
   RtR         - RtR prior
   W           - measurement covariance matrix
   Jfine       - Jacobian matrix (without applying coarse2fine mapping)

 Parameters:
   inv_model   - inv_model

 See also INV_SOLVE_DIFF_GN_ONE_STEP

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [RM, J, RtR, W, Jfine] = get_RM(inv_model)
0002 %% GET_RM: obtains the reconstruction matrix from a given inverse model
0003 %   [RM, J, RtR, W, Jfine] = get_RM(inv_model)
0004 %
0005 % Output:
0006 %   RM          - reconstruction matrix
0007 %   J           - Jacobian matrix
0008 %   RtR         - RtR prior
0009 %   W           - measurement covariance matrix
0010 %   Jfine       - Jacobian matrix (without applying coarse2fine mapping)
0011 %
0012 % Parameters:
0013 %   inv_model   - inv_model
0014 %
0015 % See also INV_SOLVE_DIFF_GN_ONE_STEP
0016 
0017 % (C) 2016 Andy Adler. License: GPL version 2 or version 3
0018 % $Id: get_RM.m 5424 2017-04-25 17:45:19Z aadler $
0019 
0020 % TODO: add caching capabilities here
0021 
0022 if isfield(inv_model, 'solve_use_matrix') && isfield(inv_model.solve_use_matrix, 'RM')
0023     % GREIT
0024     RM = inv_model.solve_use_matrix.RM;
0025 else
0026     % GN
0027     img_bkgnd= calc_jacobian_bkgnd( inv_model );
0028     J = calc_jacobian( img_bkgnd);
0029     if nargout > 4
0030         if isfield(img_bkgnd.fwd_model, 'coarse2fine')
0031             img_bkgnd.fwd_model = rmfield(img_bkgnd.fwd_model, 'coarse2fine');
0032         end
0033         Jfine = calc_jacobian( img_bkgnd);
0034     end
0035     
0036     RtR = calc_RtR_prior( inv_model );
0037     R   = calc_R_prior( inv_model );
0038     W   = calc_meas_icov( inv_model );
0039     hp  = calc_hyperparameter( inv_model );
0040     
0041     RM = (J'*W*J +  hp^2*RtR)\J'*W;
0042 end
0043 
0044 end

Generated on Fri 30-Dec-2022 19:44:54 by m2html © 2005