How to set the the cfg.outputtype when using mcxlab

225 views
Skip to first unread message

wangbi...@tju.edu.cn

unread,
Jun 26, 2016, 10:38:45 PM6/26/16
to mcx-users

Dear Professor Fang:

      I have been trying to use your mcxlab code for one week and encoured some problems about this code named as mcxlab, which I could not solve.

(1.)When I read the Readme, I find the folloing part which means that by selecting cfg.outputtype=' X', I will get the fulence.

 

But when I tried to use this in the code by adding the following code

cfg.outputtype='X';  in the demo.

, it did not work and give the following the error, then the matlab software will be closed.  


If I don't add this code, just use the default cfg, then the output.data has the sane dimension as the file cfg.vol, for example 120*100*50*10. What I want is the boundary flux which can be detected by detectors such as PMT. Please help me obtain the measureable data on the boundary. Could you explain the difference between the above three items: output flux , fluence ,energy deposit.

(2) If I want to compare the solution of Diffuse Equation with that of this mcxlab, I should write codes like cfg.srctype='isotropic'; and set the cfg.srcpos one mean free length under the surface of the tissue. Since the sourcetype is istotropic, the source has nothing with the direction. But if I use code as follows

cfg.srctype='isotropic';

cfg.srcpos=[60,50,49];

cfg.srcdir=[0 0 0];%Mean to have no direction

The matlab will give the error info

Index exceeds matrix error in dimensions.contourf(log10(squeeze(sum(f1.data(:,51,:,:),4))'),1:0.5:8);

However,When I use the code as follows

cfg.srctype='isotropic';

cfg.srcpos=[60,50,49];

Matlab will get the good results. Please help me check whether this is correct to use isotropic source.

Please help me solve these problems.I am looking forward your reply.

                            

 

 

Qianqian Fang

unread,
Jun 26, 2016, 10:48:10 PM6/26/16
to mcx-...@googlegroups.com
On 6/26/2016 10:28 AM, wangbi...@tju.edu.cn wrote:

Dear Professor Fang:

      I have been trying to use your mcxlab code for one week and encoured some problems about this code named as mcxlab, which I could not solve.

(1.)When I read the Readme, I find the folloing part which means that by selecting cfg.outputtype=' X', I will get the fulence.


But when I tried to use this in the code by adding the following code

cfg.outputtype='X';  in the demo.

, it did not work and give the following the error, then the matlab software will be closed. 


hi Bingyuan

you don't need to specify outputtype='x'. it is the default value.
I am surprised though setting this flag will cause matlab to crash.
I will investigate.


If I don't add this code, just use the default cfg, then the output.data has the sane dimension as the file cfg.vol, for example 120*100*50*10. What I want is the boundary flux which can be detected by detectors such as PMT. Please help me obtain the measureable data on the boundary. Could you explain the difference between the above three items: output flux , fluence ,energy deposit.


yes, this is the expected output. the meanings of the flux output are
explained here:

http://mcx.sourceforge.net/cgi-bin/index.cgi?Doc/FAQ#How_do_I_interpret_MCX_s_output_data

if you need data related to detected photons, you should use
the second output, detpt, of mcxlab.m. You can find help info
regarding this output by typing "help mcxlab", or here

https://github.com/fangq/mcx/blob/master/mcxlab/mcxlab.m#L112-L124


(2) If I want to compare the solution of Diffuse Equation with that of this mcxlab, I should write codes like cfg.srctype='isotropic'; and set the cfg.srcpos one mean free length under the surface of the tissue. Since the sourcetype is istotropic, the source has nothing with the direction. But if I use code as follows

cfg.srctype='isotropic';

cfg.srcpos=[60,50,49];

cfg.srcdir=[0 0 0];%Mean to have no direction



srcdir has to be a unitary vector.

if you set isotropic, the initial directory will be computed and
overwrite the srcdir setting. so you can set srcdir to any unitary
vector, such as [1 0 0] or [0 0 1]. it does not matter.

let me know if my answers help.

Qianqian

The matlab will give the error info

Index exceeds matrix error in dimensions.contourf(log10(squeeze(sum(f1.data(:,51,:,:),4))'),1:0.5:8);

However,When I use the code as follows

cfg.srctype='isotropic';

cfg.srcpos=[60,50,49];

Matlab will get the good results. Please help me check whether this is correct to use isotropic source.

Please help me solve these problems.I am looking forward your reply.

                            

 

 

--
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 post to this group, send email to mcx-...@googlegroups.com.
Visit this group at https://groups.google.com/group/mcx-users.
For more options, visit https://groups.google.com/d/optout.

wangbi...@tju.edu.cn

unread,
Jun 27, 2016, 4:41:35 AM6/27/16
to mcx-users
Dear Professor Fang, Thanks  for your reply. I am clear about all the questions except the  difference among  the physical meaning of the terms including output flux , fluence ,energy deposit.

在 2016年6月27日星期一 UTC+8上午10:38:45,wangbi...@tju.edu.cn写道:

wangbi...@tju.edu.cn

unread,
Jun 27, 2016, 5:09:53 AM6/27/16
to mcx-users
If it is possible, Please modify the code associated with the cfg.outputtype to allow obtain the Jacobian matrix. Thanks!


在 2016年6月27日星期一 UTC+8上午10:38:45,wangbi...@tju.edu.cn写道:

Dear Professor Fang:

Qianqian Fang

unread,
Jun 28, 2016, 12:59:18 PM6/28/16
to mcx-...@googlegroups.com
On 06/27/2016 04:41 AM, wangbi...@tju.edu.cn wrote:
Dear Professor Fang, Thanks  for your reply. I am clear about all the questions except the  difference among  the physical meaning of the terms including output flux , fluence ,energy deposit.

hi Bingyuan

for flux and fluence outputs, they are explained in

http://mcx.sourceforge.net/cgi-bin/index.cgi?Doc/README#Interpreting_the_Output

if normalization is disabled (cfg.isnormalized=0), energy deposit can be converted
to fluence by dividing the mua of each tetrahedron or averaged mua at each node.

please compare the below two lines (1st is for energy deposit, 2nd is for fluence):

https://github.com/fangq/mcx/blob/master/src/mcx_core.cu#L651
https://github.com/fangq/mcx/blob/master/src/mcx_core.cu#L656

for Jacobian output, we are still developing the algorithm. Once
fully validated, it means the sensitivity profile (d(fluence)/d(mua)) at
any given location. At this point, it is experimental and are not
recommended to be used in studies.

let me know if these are helpful.

Qianqian
--
Reply all
Reply to author
Forward
0 new messages