Skip to content

Commit

Permalink
Implement suggestions on pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards committed Mar 26, 2024
1 parent 39cee17 commit ca895d2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion hmri_make_dMT.m → hmri_calc_dMT.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function dMT = hmri_make_dMT(SPD,ST1,SMT,dSPD,dST1,dSMT,alpha_PD,alpha_T1,alpha_MT,TRPD,TRT1,TRMT,small_angle_approximation)
function dMT = hmri_calc_dMT(SPD,ST1,SMT,dSPD,dST1,dSMT,alpha_PD,alpha_T1,alpha_MT,TRPD,TRT1,TRMT,small_angle_approximation)
% Calculate propagation of uncertainty for MT map
% (https://en.wikipedia.org/wiki/Propagation_of_uncertainty).
% Taking the total differential from Eq. A9 in Tabelow et al., NI, 2019
Expand Down
2 changes: 1 addition & 1 deletion hmri_make_dPD.m → hmri_calc_dPD.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function dPD = hmri_make_dPD(SPD,ST1,dSPD,dST1,alpha_PD,alpha_T1,TRPD,TRT1,f_T,small_angle_approximation)
function dPD = hmri_calc_dPD(SPD,ST1,dSPD,dST1,alpha_PD,alpha_T1,TRPD,TRT1,f_T,small_angle_approximation)
% Calculate propagation of uncertainty for PD map
% (https://en.wikipedia.org/wiki/Propagation_of_uncertainty).
% % S.Mohammadi 06.09.2019
Expand Down
2 changes: 1 addition & 1 deletion hmri_make_dR1.m → hmri_calc_dR1.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function dR1 = hmri_make_dR1(SPD,ST1,dSPD,dST1,alpha_PD,alpha_T1,TRPD,TRT1,f_T,small_angle_approximation)
function dR1 = hmri_calc_dR1(SPD,ST1,dSPD,dST1,alpha_PD,alpha_T1,TRPD,TRT1,f_T,small_angle_approximation)
% Calculate propagation of uncertainty for R1 map
% (https://en.wikipedia.org/wiki/Propagation_of_uncertainty).
% S.Mohammadi 06.09.2019
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%% Main function to generate tests
function tests = hmri_make_errormaps_test
function tests = hmri_calc_errormaps_test
tests = functiontests(localfunctions);
end

function hmri_make_dR1_test(testCase)
function hmri_calc_dR1_test(testCase)
htu = hmri_test_utils;

% Define reasonable parameter set
Expand Down Expand Up @@ -51,7 +51,7 @@ function hmri_make_dR1_test(testCase)

R1est=hmri_calc_R1(PDwErr,T1wErr,B1map);

errorinR1=hmri_make_dR1(PDwErr.data,T1wErr.data,errorinPD,errorinT1,PDwErr.fa,T1wErr.fa,PDwErr.TR,T1wErr.TR,B1map,R1est);
errorinR1=hmri_calc_dR1(PDwErr.data,T1wErr.data,errorinPD,errorinT1,PDwErr.fa,T1wErr.fa,PDwErr.TR,T1wErr.TR,B1map,R1est);

merrorinR1 = mean(errorinR1,4);

Expand All @@ -67,7 +67,7 @@ function hmri_make_dR1_test(testCase)
end


function hmri_make_dPD_test(testCase)
function hmri_calc_dPD_test(testCase)
htu = hmri_test_utils;

% Define reasonable parameter set
Expand Down Expand Up @@ -115,7 +115,7 @@ function hmri_make_dPD_test(testCase)

Aest=hmri_calc_A(PDwErr,T1wErr,B1map);

modelerrorinPD=hmri_make_dPD(PDwErr.data,T1wErr.data,errorinPD,errorinT1,PDwErr.fa,T1wErr.fa,PDwErr.TR,T1wErr.TR,B1map,Aest);
modelerrorinPD=hmri_calc_dPD(PDwErr.data,T1wErr.data,errorinPD,errorinT1,PDwErr.fa,T1wErr.fa,PDwErr.TR,T1wErr.TR,B1map,Aest);

mmodelerrorinPD = mean(modelerrorinPD,4);

Expand Down
11 changes: 3 additions & 8 deletions hmri_create_MTProt.m
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,6 @@
PR2s_OLS_error{ccon} = fullfile(calcpath,[outbasename '_' 'R2s_errorESTATICS' '.nii']);
Ni = hmri_create_nifti(PR2s_OLS_error{ccon},V_pdw(1),dt,'Error map for R2s contrast');
NEmap(ccon) = Ni;

% this is unused
PR2s_OLS_mSNR = fullfile(calcpath,[outbasename '_' 'R2s_mSNR' '.nii']);
Ni = hmri_create_nifti(PR2s_OLS_mSNR,V_pdw(1),dt,'Standarized map for R2s contrast');
NSMmap = Ni;
end
end % init nifti objects for fullOLS case

Expand Down Expand Up @@ -678,7 +673,7 @@
Edata.PDw = hmri_read_vols(Verror(PDwidx),V_ref,p,mpm_params.interp);
Edata.T1w = hmri_read_vols(Verror(T1widx),V_ref,p,mpm_params.interp);

dR1 = hmri_make_dR1(PDw,T1w,Edata.PDw,Edata.T1w,fa_pdw_rad,fa_t1w_rad,TR_pdw,TR_t1w,f_T,mpm_params.small_angle_approx);
dR1 = hmri_calc_dR1(PDw,T1w,Edata.PDw,Edata.T1w,fa_pdw_rad,fa_t1w_rad,TR_pdw,TR_t1w,f_T,mpm_params.small_angle_approx);

if ISC.enabled&&~isempty(f_T)
% Use chain rule to include the imperfect spoiling
Expand Down Expand Up @@ -783,7 +778,7 @@
Edata.PDw = hmri_read_vols(Verror(PDwidx),V_ref,p,mpm_params.interp);
Edata.T1w = hmri_read_vols(Verror(T1widx),V_ref,p,mpm_params.interp);

dPD = hmri_make_dPD(PDw,T1w,Edata.PDw,Edata.T1w,fa_pdw_rad,fa_t1w_rad,TR_pdw,TR_t1w,f_T,mpm_params.small_angle_approx);
dPD = hmri_calc_dPD(PDw,T1w,Edata.PDw,Edata.T1w,fa_pdw_rad,fa_t1w_rad,TR_pdw,TR_t1w,f_T,mpm_params.small_angle_approx);

% truncate PD error maps
dPD(isinf(dPD)) = 0;
Expand Down Expand Up @@ -843,7 +838,7 @@
if mpm_params.errormaps
Edata.MTw = hmri_read_vols(Verror(MTwidx),V_ref,p,mpm_params.interp);

dMT = hmri_make_dMT(PDw,T1w,MTw,Edata.PDw,Edata.T1w,Edata.MTw,fa_pdw_rad,fa_t1w_rad,fa_mtw_rad,TR_pdw,TR_t1w,TR_mtw,mpm_params.small_angle_approx) * 100;
dMT = hmri_calc_dMT(PDw,T1w,MTw,Edata.PDw,Edata.T1w,Edata.MTw,fa_pdw_rad,fa_t1w_rad,fa_mtw_rad,TR_pdw,TR_t1w,TR_mtw,mpm_params.small_angle_approx) * 100;

if (~isempty(f_T))&&(~mpm_params.UNICORT.R1 || mpm_params.UNICORT.MT)
% use chain rule to include MTsat B1 correction in error maps
Expand Down

0 comments on commit ca895d2

Please sign in to comment.