hi everyone,
Just want to let you know that we have a new paper published on BOE describing a hybrid mesh/voxel MC method - called SVMC (split-voxel MC). It specifically addresses certain errors caused by the terraced surfaces in voxel-based MC, including errors next
to thin-layer of high-contrast tissues (like CSV) and incorrect reflection/transmission near a curved surface, as pointed out by several previous publications. See the full story here
https://www.osapublishing.org/boe/fulltext.cfm?uri=boe-11-11-6262&id=440955
My student Shijie Yan, who has led the development of this code, had just merged the fully tested new feature to our github repository, and this function is now included in our nightly build mcxlab packages. If you are interested in giving this approach
a try, please go to the below link and get the latest mcxlab (mcx binary also supports this feature, but requires a hybrid volume binary file per-generated from
mcxsvmc.m, we will add demos next)
Shijie also added 3 examples to mcxlab, corresponding to the B1/B2/B3 benchmarks in our paper, see mcxlab/examples/demo_svmc_*.m
If you are modeling thin high-contrast curved media, or trying to model reflection/transmission of a curved boundary in mcx, I strongly recommend you to try the svmc-capable mcxlab, at least compare the result with and without svmc. This new method drops
the simulation speed by about 50%, but the result is more robust for curved objects, similar to mmc.
let us know if you have any questions regarding this new work
cheers!
Qianqian
hi Angelo,
sorry that I did not get back to your previous email on this.
I tested various source types for the demo_cube_sphere.m example, including planar, cone, disk etc, all of them run without any problem.
I think it might be because of the version you are using. can you
verify your mcx version? can you try using the latest version
instead? what OS do you use? check out the github action-built
packages
https://mcx.space/nightly/github/
Qianqian
>> demo_svmc_cubesph
SVMC preprocessing complete, Elapsed time is 0.086785 seconds.
Launching MCXLAB - Monte Carlo eXtreme for MATLAB & GNU
Octave ...
Running simulations for configuration #1 ...
mcx.nphoton=1e+08;
mcx.seed=2072082351;
mcx.issrcfrom0=1;
mcx.srcpos=[61 61 0 1];
mcx.srcdir=[0 0 1 0];
mcx.srctype='planar';
mcx.srcparam1=[5 0 0 0];
mcx.srcparam2=[0 5 0 0];
mcx.medianum=2;
mcx.tstart=0;
mcx.tend=5e-09;
mcx.tstep=5e-10;
mcx.isreflect=1;
mcx.unitinmm=0.5;
mcx.outputtype='fluence';
mcx.gpuid=1;
mcx.autopilot=1;
mcx.dim=[120 120 120];
mcx.mediabyte=1;
###############################################################################
# Monte Carlo eXtreme (MCX) --
CUDA #
# Copyright (c) 2009-2025 Qianqian Fang <q.fang at
neu.edu> #
# https://mcx.space/ &
https://neurojson.io #
#
#
# Computational Optics & Translational Imaging (COTI) Lab-
http://fanglab.org #
# Department of Bioengineering, Northeastern University,
Boston, MA, USA #
###############################################################################
# The MCX Project is funded by the NIH/NIGMS under grant
R01-GM114365 #
###############################################################################
# Open-source codes and reusable scientific data are essential
for research, #
# MCX proudly developed human-readable JSON-based data formats
for easy reuse.#
#
#
#Please visit our free scientific data sharing portal at
https://neurojson.io #
# and consider sharing your public datasets in standardized
JSON/JData format #
###############################################################################
$Rev::b99a33$v2025.6 $Date::2025-06-01 09:06:59 -04$ by
$Author::Qianqian Fang$
###############################################################################
- code name: [Kilo-Kelvin] compiled by nvcc [11.5] for CUDA-arch
[350] on [Sep 3 2025]
- compiled with: RNG [xorshift128+] seed length [4]
GPU=1 (NVIDIA GeForce RTX 4070 Laptop GPU) threadph=678
extra=24832 np=100000000 nthread=147456 maxgate=10 repetition=1
initializing streams ... init complete : 2 ms
requesting shared memory: 1280 bytes
launching MCX simulation for time window [0.00e+00ns 5.00e+00ns]
...
simulation run# 1 ...
kernel complete: 3062 ms
retrieving fields ... transfer complete: 3112 ms
normalizing raw data ... source 1, normalization factor
alpha=0.000000
data normalization complete : 3297 ms
simulated 100000000 photons (100000000) with 147456 threads
(repeat x1)
MCX simulation speed: 32916.39 photon/ms
total simulated energy: 100000000.00 absorbed: 21.63050%
(loss due to initial specular reflection is excluded in the
total)
Launching MCXLAB - Monte Carlo eXtreme for MATLAB & GNU
Octave ...
Running simulations for configuration #1 ...
mcx.nphoton=1e+08;
mcx.seed=2072082351;
mcx.issrcfrom0=1;
mcx.srcpos=[30.5 30.5 0 1];
mcx.srcdir=[0 0 1 0];
mcx.srctype='planar';
mcx.srcparam1=[5 0 0 0];
mcx.srcparam2=[0 5 0 0];
mcx.medianum=2;
mcx.tstart=0;
mcx.tend=5e-09;
mcx.tstep=5e-10;
mcx.isreflect=1;
mcx.unitinmm=1;
mcx.outputtype='fluence';
mcx.gpuid=1;
mcx.autopilot=1;
mcx.dim=[60 60 60];
mcx.mediabyte=97;
###############################################################################
# Monte Carlo eXtreme (MCX) --
CUDA #
# Copyright (c) 2009-2025 Qianqian Fang <q.fang at
neu.edu> #
# https://mcx.space/ &
https://neurojson.io #
#
#
# Computational Optics & Translational Imaging (COTI) Lab-
http://fanglab.org #
# Department of Bioengineering, Northeastern University,
Boston, MA, USA #
###############################################################################
# The MCX Project is funded by the NIH/NIGMS under grant
R01-GM114365 #
###############################################################################
# Open-source codes and reusable scientific data are essential
for research, #
# MCX proudly developed human-readable JSON-based data formats
for easy reuse.#
#
#
#Please visit our free scientific data sharing portal at
https://neurojson.io #
# and consider sharing your public datasets in standardized
JSON/JData format #
###############################################################################
$Rev::b99a33$v2025.6 $Date::2025-06-01 09:06:59 -04$ by
$Author::Qianqian Fang$
###############################################################################
- code name: [Kilo-Kelvin] compiled by nvcc [11.5] for CUDA-arch
[350] on [Sep 3 2025]
- compiled with: RNG [xorshift128+] seed length [4]
GPU=1 (NVIDIA GeForce RTX 4070 Laptop GPU) threadph=678
extra=24832 np=100000000 nthread=147456 maxgate=10 repetition=1
initializing streams ... init complete : 0 ms
requesting shared memory: 1280 bytes
launching MCX simulation for time window [0.00e+00ns 5.00e+00ns]
...
simulation run# 1 ...
kernel complete: 3968 ms
retrieving fields ... transfer complete: 3972 ms
normalizing raw data ... source 1, normalization factor
alpha=0.000000
data normalization complete : 3991 ms
simulated 100000000 photons (100000000) with 147456 threads
(repeat x1)
MCX simulation speed: 25342.12 photon/ms
total simulated energy: 100000000.00 absorbed: 22.23949%
(loss due to initial specular reflection is excluded in the
total)
You don't often get email from angelo...@gmail.com. Learn why this is important
Dear Qianqian,
I am not sure if I found a bug, but in all the demos of the SVMC (like the demo_cube_sph) if I try to change the pencil source
% pencil beam light sourcecfg.srcpos = [30.5 30.5 0];cfg.srcdir = [0 0 1];with a planar one (e.g.)cfg.srcpos = [30.5 30.5 0];cfg.srcdir = [0 0 1];cfg.srctype='planar';cfg.srcparam1=[5 0 0 0];cfg.srcparam2=[0 5 0 0];
the code will generate the following error:
the reason is that "phi_svmc" is empty array.
if I try to go back to the pencil beam source, I cannot rerun it, and I will get a new error:
Not only that, all the other MC codes will not be able to run. The only way to fix this problem is to restart MATLAB.Thank you.Angelo
On Friday, October 23, 2020 at 7:10:40 PM UTC-4 Fang, Qianqian wrote:
hi everyone,
Just want to let you know that we have a new paper published on BOE describing a hybrid mesh/voxel MC method - called SVMC (split-voxel MC). It specifically addresses certain errors caused by the terraced surfaces in voxel-based MC, including errors next to thin-layer of high-contrast tissues (like CSV) and incorrect reflection/transmission near a curved surface, as pointed out by several previous publications. See the full story here
https://www.osapublishing.org/boe/fulltext.cfm?uri=boe-11-11-6262&id=440955
My student Shijie Yan, who has led the development of this code, had just merged the fully tested new feature to our github repository, and this function is now included in our nightly build mcxlab packages. If you are interested in giving this approach a try, please go to the below link and get the latest mcxlab (mcx binary also supports this feature, but requires a hybrid volume binary file per-generated from mcxsvmc.m, we will add demos next)
Shijie also added 3 examples to mcxlab, corresponding to the B1/B2/B3 benchmarks in our paper, see mcxlab/examples/demo_svmc_*.m
If you are modeling thin high-contrast curved media, or trying to model reflection/transmission of a curved boundary in mcx, I strongly recommend you to try the svmc-capable mcxlab, at least compare the result with and without svmc. This new method drops the simulation speed by about 50%, but the result is more robust for curved objects, similar to mmc.
let us know if you have any questions regarding this new work
cheers!
Qianqian
--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mcx-users/1e6ed510-1a52-4595-92c6-bae04ba81cddn%40googlegroups.com.
hi Angelo,
I tested the following two packages on a windows laptop
v2025:
https://mcx.space/nightly/release/v2025/MCXStudio-win64-v2025-installer.exe
and the latest github version:
https://mcx.space/nightly/github/mcxlab-allinone-github-latest.zip
I confirm that v2025 gave the memory misalignment error you on windows.
however, the latest github version runs both pencil beam and the planar source correctly without an error. The system is Windows 11, with an NVIDIA 4070 laptop GPU
see screenshot attached. if you haven't tried the "mcxlab-allinone-github-latest.zip" zip file above, give it a try
Qianqian
To view this discussion visit https://groups.google.com/d/msgid/mcx-users/798a0199-e990-4bd9-a11f-c4da98a668c9n%40googlegroups.com.
Angelo,
as long as you add the path to all needed functions, the script
should run. not all of them are in mcxlab*.zip, which is just
meant to provide the mcx mex file as a module in the full suite.
if any of those are missing, you should download it separately, unzip and addpath, until all needed functions are found in matlab.
the needed packages likely include
- mcxlab.m: mcxlab*.zip
- mcxsvmc.m: mcx*.zip under mcx/utils
- varargin2struct/jsonopt: iso2mesh or jsonlab
if you install the windows installer (https://mcx.space/nightly/win64/MCXStudio-nightlybuild-installer.exe), it is supposed to add path to all needed components, but for this particularly nightlybuild copy, I haven't been able to verify if it works.
Qianqian
To view this discussion visit https://groups.google.com/d/msgid/mcx-users/CAJNg7ozBE36XVzPZCHKy_HJMTCcZZjKeqzPHGo0yK%3DxDs-u05g%40mail.gmail.com.