Question of MCXLAB creating single vessel model

132 views
Skip to first unread message

Yu Sun

unread,
Nov 25, 2021, 6:57:31 PM11/25/21
to mcx-users
Hi Dr. Fang,

I am trying to use mcxlab to simulate a single vessel inside a 2  cubic domain, which vessel is inside the top layer. Here is my code:
cfg.unitinmm = 0.1;
cfg.nphoton=1e7; 
cfg.issrcfrom0 = 1;
cfg.srctype='disk';
cfg.srcparam1=[3 0 0 0 ];% radium and half angle in radian
cfg.srcdir=[0 0 1];
cfg.vol=uint8(ones(300,300,150));
cfg.shapes='{"Shapes":[{"Cylinder":{"Tag":2,"C0": [0.0,150.0,10.0], "C1":[300.0,150.0,10.0],"R":5.0}}]}';
cfg.vol(:,:,30:end) = 3;
x = size(cfg.vol,1)/2;
y = size(cfg.vol,2)/2;
z = 0; 
cfg.srcpos=[x y z];
cfg.tstart=0;
cfg.tend=5e-9;
cfg.tstep=5e-9;
cfg.autopilot=1;
cfg.gpuid=1;
cfg.isnormalized = 1;
cfg.issaveref = 1; %
cfg.issaveexit = 1;
cfg.debuglevel='P';
cfg.detpos = [x+10.4  y+0   z  3];
cfg.prop=[0 0 1 1;
     0.1089 0.7094 0.9 1.37
     0.23 1.421 0.9 1.37
     0.1549 0.5275 0.9 1.37];
[flux,detp,vol,seeds]=mcxlab(cfg);
I have 2 questions;
1. Did I use the cfg.shape correctly? What does the C0 &C1 control? In the demo_mcxyz_skinvessel, it also used the shape  'ZLayers'. Could you explain these different shape functions a little bit?
2. How could I show the cfg data? I tried to use the function 'mcxpreview(cfg)', however, the plot only showed 2 cubic layers without the cylinder. Did I make a mistake on model creation?
domain preview.bmp
Thank you!
Best,
Yu

Qianqian Fang

unread,
Nov 26, 2021, 5:48:45 PM11/26/21
to mcx-...@googlegroups.com

hi Yu,

a few comments -

first, the mcxpreview function failed with your domain due to a combination of several things - first, although mcx accepts both cfg.vol and cfg.shapes, the mcxpreview function could not handle it; secondly, the mcxplotshapes function used to handle cfg.shapes does not support cfg.unitinmm, thus, even it can be plotted, it will be in a different scale if your cfg.unitinmm is not 1.

I have fixed both, see the below bug tracker, and now your cfg should be displayed correct

https://github.com/fangq/mcx/issues/131


for your question on the C0/C1 and ZLayers shape constructs, you can find more info in the "MCX_Shape_Command_Help" section of the README: https://github.com/fangq/mcx#using-json-formatted-shape-description-files

for a two-layered domain, you can use "ZLayers" in cfg.shapes, such as


cfg.shapes='{"Shapes":[{"ZLayers":[[1,29,1],[30,150,3]]},{"Cylinder":{"Tag":2,"C0": [0.0,150.0,10.0], "C1":[300.0,150.0,10.0],"R":5.0}}]}';


if you define the above shapes, you could remove the cfg(...30:end) line - but even you don't, the results will be the same because the shape constructs overlays on top of cfg.vol.


let me know if you have further questions.


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 on the web visit https://groups.google.com/d/msgid/mcx-users/7523b915-fb7a-4426-84d9-327f91597ccdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages