-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mcxlab] add speed comparison between different media formats
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% MCXLAB - Monte Carlo eXtreme for MATLAB/Octave by Qianqina Fang | ||
% | ||
% In this example, we show why using label-based simulation is preferred | ||
% over per-voxel medium formats whenever possible. | ||
% | ||
% This file is part of Monte Carlo eXtreme (MCX) URL:http://mcx.sf.net | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
% only clear cfg to avoid accidentally clearing other useful data | ||
clear cfg cfgs; | ||
cfg.nphoton = 1e7; | ||
cfg.vol = uint8(ones(60, 60, 60)); | ||
cfg.vol(:, :, 4:10) = 2; | ||
cfg.srcpos = [30 30 1]; | ||
cfg.srcdir = [0 0 1]; | ||
cfg.detpos = [30 33 1 2]; | ||
cfg.gpuid = 1; | ||
% cfg.gpuid='11'; % use two GPUs together | ||
cfg.autopilot = 1; | ||
cfg.prop = [0 0 1 1; 0.05 1 0 1.37; 0.1 1 0 1.37]; | ||
cfg.tstart = 0; | ||
cfg.tend = 5e-9; | ||
cfg.tstep = 5e-9; | ||
|
||
%% simulate with lable-based medium | ||
tic; | ||
flux = mcxlab(cfg); | ||
toc; | ||
|
||
%% simulate with mua_float format | ||
cfg2 = cfg; | ||
cfg2.vol = reshape(single(cfg.prop(cfg.vol + 1, 1)), [1 size(cfg.vol)]); | ||
|
||
tic; | ||
flux2 = mcxlab(cfg2); | ||
toc; | ||
|
||
%% simulate with muamus_float format | ||
cfg3 = cfg; | ||
cfg3.vol = reshape(single(cfg.prop(cfg.vol + 1, 1:2))', [2 size(cfg.vol)]); | ||
|
||
tic; | ||
flux3 = mcxlab(cfg3); | ||
toc; | ||
|
||
%% simulate with asgn_float format | ||
cfg4 = cfg; | ||
cfg4.vol = reshape(single(cfg.prop(cfg.vol + 1, 1:4))', [4 size(cfg.vol)]); | ||
|
||
tic; | ||
flux4 = mcxlab(cfg4); | ||
toc; |