From 25854710bcc34fa81755ba5937445f191b3a2e58 Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Thu, 4 Nov 2021 13:51:11 -0400 Subject: [PATCH] making svmc matlab demos compatible with Octave 5 --- .../demo_diffuse_reflectance_validation.m | 5 ++--- mcxlab/examples/demo_fullhead_atlas.m | 2 -- mcxlab/examples/demo_label_continous_hybrid.m | 2 -- mcxlab/examples/demo_svmc_brain19_5.m | 11 +++++------ mcxlab/examples/demo_svmc_cubesph.m | 11 +++++------ mcxlab/examples/demo_svmc_sphshells.m | 15 +++++++-------- utils/mcxsvmc.m | 4 ++-- 7 files changed, 21 insertions(+), 29 deletions(-) diff --git a/mcxlab/examples/demo_diffuse_reflectance_validation.m b/mcxlab/examples/demo_diffuse_reflectance_validation.m index e7882495..a1ad8537 100644 --- a/mcxlab/examples/demo_diffuse_reflectance_validation.m +++ b/mcxlab/examples/demo_diffuse_reflectance_validation.m @@ -15,9 +15,8 @@ % % This file is part of Monte Carlo eXtreme (MCX) URL:http://mcx.sf.net %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -clc -clear -close all + +clear cfg %% Monte Carlo cfg.nphoton=1e8; % photon number diff --git a/mcxlab/examples/demo_fullhead_atlas.m b/mcxlab/examples/demo_fullhead_atlas.m index 9b470020..7b4f015b 100644 --- a/mcxlab/examples/demo_fullhead_atlas.m +++ b/mcxlab/examples/demo_fullhead_atlas.m @@ -16,8 +16,6 @@ % This file is part of Monte Carlo eXtreme (MCX) URL:http://mcx.sf.net %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -clc -clear load('fullhead_atlas.mat'); %% prepare cfg for MCX simulation clear cfg diff --git a/mcxlab/examples/demo_label_continous_hybrid.m b/mcxlab/examples/demo_label_continous_hybrid.m index ef9c1025..130f43ea 100644 --- a/mcxlab/examples/demo_label_continous_hybrid.m +++ b/mcxlab/examples/demo_label_continous_hybrid.m @@ -1,5 +1,3 @@ -clear -clc %% case 1: homogenous media, update the refractive index from n_old to n_new for all voxels clear cfg1 diff --git a/mcxlab/examples/demo_svmc_brain19_5.m b/mcxlab/examples/demo_svmc_brain19_5.m index cc9874d1..eaa9f7cc 100644 --- a/mcxlab/examples/demo_svmc_brain19_5.m +++ b/mcxlab/examples/demo_svmc_brain19_5.m @@ -20,9 +20,8 @@ % % This file is part of Monte Carlo eXtreme (MCX) URL:http://mcx.sf.net %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -clc -clear -close all + +clear cfg cfg_svmc %% common MC setup cfg.nphoton=1e8; @@ -103,15 +102,15 @@ figure; clines=-20:0.5:0; contourf(xx-0.5,zz-0.5,log10(abs(phi_svmc_interp')),clines,'linestyle','-',... - 'color','k','linewidth',2,'DisplayName','SVMC'); + 'linecolor','k','linewidth',2,'DisplayName','SVMC'); hold on; contour(xx,zz,log10(abs(squeeze(phi_vmc(:,ceil(y_plane),:))')),clines,'linestyle','--',... - 'color','w','linewidth',2,'DisplayName','VMC'); + 'linecolor','w','linewidth',2,'DisplayName','VMC'); colorbar('EastOutside'); % plot tissue boundaries contour(squeeze(USC_atlas(:,ceil(y_plane),:))','linestyle','--',... - 'color',[0.5 0.5 0.5],'linewidth',1.5,'HandleVisibility','off'); + 'linecolor',[0.5 0.5 0.5],'linewidth',1.5,'HandleVisibility','off'); axis equal; lg=legend; diff --git a/mcxlab/examples/demo_svmc_cubesph.m b/mcxlab/examples/demo_svmc_cubesph.m index 08359f40..3d04a671 100644 --- a/mcxlab/examples/demo_svmc_cubesph.m +++ b/mcxlab/examples/demo_svmc_cubesph.m @@ -10,9 +10,8 @@ % % This file is part of Monte Carlo eXtreme (MCX) URL:http://mcx.sf.net %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -clc -clear -close all + +clear cfg cfg_svmc %% common MC setup cfg.nphoton=1e8; @@ -90,14 +89,14 @@ figure; clines=-10:0.5:10; contourf(yy_svmc,zz_svmc,log10(abs(squeeze(phi_svmc(31,:,:)))),clines,'linestyle','-',... - 'color','k','linewidth',2,'DisplayName','SVMC'); + 'linecolor','k','linewidth',2,'DisplayName','SVMC'); hold on; contour(yy_vmc,zz_vmc,log10(abs(squeeze(phi_vmc(61,:,:)))),clines,'linestyle','--',... - 'color','w','linewidth',2,'DisplayName','VMC'); + 'linecolor','w','linewidth',2,'DisplayName','VMC'); colorbar('EastOutside'); % plot media boundaries -[xcirc,ycirc] = cylinder(25,200); +[xcirc,ycirc] = cylinder([25,25],200); xcirc=xcirc(1,:)+30.5; ycirc=ycirc(1,:)+30.5; plot(xcirc,ycirc,'--','linewidth',1.5,'color',[.5 .5 .5],'HandleVisibility','off'); diff --git a/mcxlab/examples/demo_svmc_sphshells.m b/mcxlab/examples/demo_svmc_sphshells.m index 1c82b8c8..bf5be77a 100644 --- a/mcxlab/examples/demo_svmc_sphshells.m +++ b/mcxlab/examples/demo_svmc_sphshells.m @@ -14,9 +14,8 @@ % % This file is part of Monte Carlo eXtreme (MCX) URL:http://mcx.sf.net %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -clc -clear -close all + +clear cfg cfg_svmc %% common MC setup cfg.nphoton=1e8; @@ -94,24 +93,24 @@ figure; clines=-10:0.5:10; contourf(log10(abs(squeeze(phi_svmc(31,:,:))')),clines,'linestyle','-',... - 'color','k','linewidth',2,'DisplayName','SVMC'); + 'linecolor','k','linewidth',2,'DisplayName','SVMC'); hold on; contour(log10(abs(squeeze(phi_vmc(31,:,:))')),clines,'linestyle','--',... - 'color','w','linewidth',2,'DisplayName','VMC'); + 'linecolor','w','linewidth',2,'DisplayName','VMC'); colorbar('EastOutside'); % plot media boundaries -[xcirc,ycirc] = cylinder(10,200); +[xcirc,ycirc] = cylinder([10,10],200); xcirc=xcirc(1,:)+31; ycirc=ycirc(1,:)+31; plot(xcirc,ycirc,'--','linewidth',1.5,'color',[.5 .5 .5],'HandleVisibility','off'); -[xcirc,ycirc] = cylinder(23,200); +[xcirc,ycirc] = cylinder([23,23],200); xcirc=xcirc(1,:)+31; ycirc=ycirc(1,:)+31; plot(xcirc,ycirc,'--','linewidth',1.5,'color',[.5 .5 .5],'HandleVisibility','off'); -[xcirc,ycirc] = cylinder(25,200); +[xcirc,ycirc] = cylinder([25,25],200); xcirc=xcirc(1,:)+31; ycirc=ycirc(1,:)+31; plot(xcirc,ycirc,'--','linewidth',1.5,'color',[.5 .5 .5],'HandleVisibility','off'); diff --git a/utils/mcxsvmc.m b/utils/mcxsvmc.m index da974c48..f75c08ce 100644 --- a/utils/mcxsvmc.m +++ b/utils/mcxsvmc.m @@ -95,7 +95,7 @@ % convert each label into a binary mask, smooth it, then extract the % isosurface using marching cube algorithm (matlab builtin) if(dosmooth) - volsmooth=smooth3(vol==labels(i),'g',ksize,kstd); + volsmooth=smooth3(double(vol==labels(i)),'g',ksize,kstd); else volsmooth=(vol==labels(i)); end @@ -203,7 +203,7 @@ nc=nc-floor(nc); nc=floor(nc*255); -nn=floor((nn+1)*255/2); +nn=min(floor((nn+1)*255/2),254); %% assemble the final volume if(nargout==1)