0001 function [fh, fe] = s_pestilli_etal_Figures_4_5()
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 feOpenLocalCluster;
0014
0015
0016 dwiFile = fullfile(lifeDemoDataPath('diffusion'),'pestilli_etal_life_demo_scan1_subject1_b2000_150dirs_stanford.nii.gz');
0017 dwiFileRepeat = fullfile(lifeDemoDataPath('diffusion'),'pestilli_etal_life_demo_scan2_subject1_b2000_150dirs_stanford.nii.gz');
0018 t1File = fullfile(lifeDemoDataPath('anatomy'), 'pestilli_etal_life_demo_anatomy_t1w_stanford.nii.gz');
0019
0020
0021
0022
0023 fgFileName = fullfile(lifeDemoDataPath('tractography'), ...
0024 'pestilli_et_al_life_demo_mrtrix_csd_lmax10_probabilistic.mat');
0025
0026
0027 feFileName = 'life_build_model_demo_CSD_PROB';
0028
0029
0030
0031 fe = feConnectomeInit(dwiFile,fgFileName,feFileName,[],dwiFileRepeat,t1File);
0032
0033
0034 fe = feSet(fe,'fit',feFitModel(feGet(fe,'mfiber'),feGet(fe,'dsigdemeaned'),'bbnnls'));
0035
0036
0037 [fh(1), ~, ~] = plotHistRMSE(fe,'Probabilistic');
0038
0039
0040
0041
0042 [fh(2), ~] = plotHistRrmse(fe,'Probabilistic');
0043
0044
0045 [fh(3), ~] = plotHistWeigths(fe,'Probabilistic');
0046
0047
0048
0049
0050 fgFileName = fullfile(lifeDemoDataPath('tractography'), ...
0051 'pestilli_et_al_life_demo_mrtrix_tensor_deterministic.mat');
0052
0053
0054 feFileName = 'life_build_model_demo_TENSOR_DET';
0055
0056
0057 fe = feConnectomeInit(dwiFile,fgFileName,feFileName,[],dwiFileRepeat,t1File);
0058
0059
0060 fe = feSet(fe,'fit',feFitModel(feGet(fe,'mfiber'),feGet(fe,'dsigdemeaned'),'bbnnls'));
0061
0062
0063 [fh(1), ~, ~] = plotHistRMSE(fe,'Deterministic');
0064
0065
0066
0067
0068 [fh(2), ~] = plotHistRrmse(fe,'Deterministic');
0069
0070
0071 [fh(3), ~] = plotHistWeigths(fe,'Deterministic');
0072
0073 keyboard
0074 end
0075
0076
0077 function [fh, rmse, rmsexv] = plotHistRMSE(fe,tractograpy)
0078
0079
0080
0081 rmse = feGet(fe,'vox rmse');
0082
0083
0084
0085 rmsexv = feGetRep(fe,'vox rmse');
0086
0087 figName = sprintf('%s - RMSE',tractograpy);
0088 fh = mrvNewGraphWin(figName);
0089 [y,x] = hist(rmse,50);
0090 plot(x,y,'k-');
0091 hold on
0092 [y,x] = hist(rmsexv,50);
0093 plot(x,y,'r-');
0094 set(gca,'tickdir','out','fontsize',16,'box','off');
0095 title('Root-mean squared error distribution across voxels','fontsize',16);
0096 ylabel('number of voxels','fontsize',16);
0097 xlabel('rmse (scanner units)','fontsize',16);
0098 legend({'RMSE fitted data set','RMSE cross-validated'},'fontsize',16);
0099 end
0100
0101 function [fh, R] = plotHistRrmse(fe,tractograpy)
0102
0103 R = feGetRep(fe,'voxrmseratio');
0104 figName = sprintf('%s - RMSE RATIO',tractograpy);
0105 fh = mrvNewGraphWin(figName);
0106 [y,x] = hist(R,linspace(.5,4,50));
0107 plot(x,y,'k-','linewidth',2);
0108 hold on
0109 plot([median(R) median(R)],[0 1200],'r-','linewidth',2);
0110 plot([1 1],[0 1200],'k-');
0111 set(gca,'tickdir','out','fontsize',16,'box','off');
0112 title('Root-mean squared error ratio','fontsize',16);
0113 ylabel('number of voxels','fontsize',16);
0114 xlabel('R_{rmse}','fontsize',16);
0115 legend({sprintf('Distribution of R_{rmse}'),sprintf('Median R_{rmse}')});
0116 end
0117
0118 function [fh, w] = plotHistWeigths(fe,tractograpy)
0119
0120 w = feGet(fe,'fiber weights');
0121 figName = sprintf('%s - Distribution of fascicle weights',tractograpy);
0122 fh = mrvNewGraphWin(figName);
0123 [y,x] = hist(w( w > 0 ),logspace(-5,-.3,40));
0124 semilogx(x,y,'k-','linewidth',2)
0125 set(gca,'tickdir','out','fontsize',16,'box','off')
0126 title( ...
0127 sprintf('Number of fascicles candidate connectome: %2.0f\nNumber of fascicles in optimized connetome: %2.0f' ...
0128 ,length(w),sum(w > 0)),'fontsize',16)
0129 ylabel('Number of fascicles','fontsize',16)
0130 xlabel('Fascicle weight','fontsize',16)
0131 end
0132