Skip to content

Commit

Permalink
making svmc matlab demos compatible with Octave 5
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Nov 4, 2021
1 parent 5976811 commit 2585471
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 29 deletions.
5 changes: 2 additions & 3 deletions mcxlab/examples/demo_diffuse_reflectance_validation.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions mcxlab/examples/demo_fullhead_atlas.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions mcxlab/examples/demo_label_continous_hybrid.m
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 5 additions & 6 deletions mcxlab/examples/demo_svmc_brain19_5.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions mcxlab/examples/demo_svmc_cubesph.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down
15 changes: 7 additions & 8 deletions mcxlab/examples/demo_svmc_sphshells.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions utils/mcxsvmc.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2585471

Please sign in to comment.