0001 function s_pestilli_etal_figure_7()
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 datapath = pestilliDataPath;
0024 
0025 
0026 
0027 feProbFileName = 'subject1_life_culled_2mm_150dir_b2000_probabilistic_lmax8_diffModAx100Rd0.mat';
0028 feDetFileName  = 'subject1_life_culled_2mm_150dir_b2000_tensor_diffModAx100Rd0.mat';
0029 
0030 fprintf('Loading precomputed LiFE models for probabilistic (P) and deterministic (D) connectomes...\n')
0031 p = load(fullfile(datapath,'life_structures',feProbFileName));
0032 d = load(fullfile(datapath,'life_structures',feDetFileName)); 
0033 
0034 
0035 
0036 fprintf('Computing Root-Mean-Square-Error (RMSE) for each brain voxel and tractography model..\n')
0037 p.rmse   = feGetRep(p.fe,'vox rmse');
0038 d.rmse   = feGetRep(d.fe, 'vox rmse');
0039 
0040 
0041 
0042 
0043 
0044 
0045 
0046 
0047 
0048 
0049 
0050 
0051 
0052 
0053 
0054 
0055 
0056 
0057 
0058 
0059 
0060 fprintf('Finding common brain coordinates between P and D connectomes...\n')
0061 p.coords = feGet(   p.fe,'roi coords');
0062 d.coords = feGet(   d.fe, 'roi coords');
0063 prob.coordsIdx = ismember(p.coords,d.coords,'rows');
0064 prob.coords   = p.coords(prob.coordsIdx,:);
0065 det.coordsIdx = ismember(d.coords,prob.coords,'rows');
0066 det.coords    = d.coords(det.coordsIdx,:);
0067 prob.rmse  = p.rmse( prob.coordsIdx);
0068 det.rmse   = d.rmse( det.coordsIdx);
0069 
0070 
0071 
0072 scatterPlotRMSE(det,prob)
0073 
0074 
0075 se = feComputeEvidence(p.rmse,d.rmse);
0076 
0077 
0078 
0079 
0080 distributionPlotStrengthOfEvidence(se.s.unlesioned_e,se.s.lesioned_e,se.s.mean,se.s.std,se.s.unlesioned.xbins, se.s.lesioned.xbins)
0081 
0082 
0083 
0084 
0085 
0086 
0087 distributionPlotEarthMoversDistance(se.nolesion,se.lesion,se.em)
0088 
0089 end 
0090 
0091 
0092 function scatterPlotRMSE(det,prob)
0093 figNameRmse = sprintf('prob_vs_det_rmse_common_voxels_map');
0094 mrvNewGraphWin(figNameRmse);
0095 [ymap,x]  = hist3([det.rmse;prob.rmse]',{[10:1:70], [10:1:70]});
0096 ymap = ymap./length(prob.rmse);
0097 sh   = imagesc(flipud(log10(ymap)));
0098 cm   = colormap(flipud(hot)); view(0,90);
0099 axis('square')      
0100 set(gca, ...
0101     'xlim',[1 length(x{1})],...
0102     'ylim',[1 length(x{1})], ...
0103     'ytick',[1 (length(x{1})/2) length(x{1})], ...
0104     'xtick',[1 (length(x{1})/2) length(x{1})], ...
0105     'yticklabel',[x{1}(end) x{1}(round(end/2)) x{1}(1)], ...
0106     'xticklabel',[x{1}(1)   x{1}(round(end/2)) x{1}(end)], ...
0107     'tickdir','out','ticklen',[.025 .05],'box','off', ...
0108     'fontsize',16,'visible','on')
0109 hold on
0110 plot3([1 length(x{1})],[length(x{1}) 1],[max(ymap(:)) max(ymap(:))],'k-','linewidth',1)
0111 ylabel('Deterministic_{rmse}','fontsize',16)
0112 xlabel('Probabilistic_{rmse}','fontsize',16)
0113 cb = colorbar;
0114 tck = get(cb,'ytick');
0115 set(cb,'yTick',[min(tck)  mean(tck) max(tck)], ...
0116     'yTickLabel',round(1000*10.^[min(tck),...
0117     mean(tck), ...
0118     max(tck)])/1000, ...
0119     'tickdir','out','ticklen',[.025 .05],'box','on', ...
0120     'fontsize',16,'visible','on')
0121 end
0122 
0123 function distributionPlotStrengthOfEvidence(y_e,ywo_e,dprime,std_dprime,xhis,woxhis)
0124 histcolor{1} = [0 0 0];
0125 histcolor{2} = [.95 .6 .5];
0126 figName = sprintf('Strength_of_Evidence_test_PROB_vs_DET_model_rmse_mean_HIST');
0127 mrvNewGraphWin(figName);
0128 patch([xhis,xhis],y_e(:),histcolor{1},'FaceColor',histcolor{1},'EdgeColor',histcolor{1});
0129 hold on
0130 patch([woxhis,woxhis],ywo_e(:),histcolor{2},'FaceColor',histcolor{2},'EdgeColor',histcolor{2}); 
0131 set(gca,'tickdir','out', ...
0132         'box','off', ...
0133         'ticklen',[.025 .05], ...
0134         'ylim',[0 .2], ...
0135         'xlim',[28 34], ...
0136         'xtick',[28 30 32 34], ...
0137         'ytick',[0 .1 .2], ...
0138         'fontsize',16)
0139 ylabel('Probability','fontsize',16)
0140 xlabel('rmse','fontsize',16')
0141 
0142 title(sprintf('Strength of evidence:\n mean %2.3f - std %2.3f',dprime,std_dprime), ...
0143     'FontSize',16)
0144 legend({'Probabilistic','Deterministic'})
0145 end
0146 
0147 
0148 function distributionPlotEarthMoversDistance(prob,det,em)
0149 histcolor{1} = [0 0 0];
0150 histcolor{2} = [.95 .6 .5];
0151 figName = sprintf('EMD_PROB_DET_model_rmse_mean_HIST');
0152 mrvNewGraphWin(figName);
0153 plot(prob.xhist,prob.hist,'r-','color',histcolor{1},'linewidth',4);
0154 hold on
0155 plot(det.xhist,det.hist,'r-','color',histcolor{2},'linewidth',4); 
0156 set(gca,'tickdir','out', ...
0157         'box','off', ...
0158         'ticklen',[.025 .05], ...
0159         'ylim',[0 .12], ...
0160         'xlim',[0 95], ...
0161         'xtick',[0 45 90], ...
0162         'ytick',[0 .06 .12], ...
0163         'fontsize',16)
0164 ylabel('Proportion white-matter volume','fontsize',16)
0165 xlabel('RMSE (raw MRI scanner units)','fontsize',16')
0166 title(sprintf('Earth Movers Distance: %2.3f (raw scanner units)',em.mean),'FontSize',16)
0167 legend({'Probabilistic','Deterministic'})
0168 end