Queries regarding mcxlab code

67 views
Skip to first unread message

Saurabh Nair

unread,
Feb 22, 2021, 8:09:12 AM2/22/21
to mcx-users

Dear Dr. Fang,

I am working on a project involving MC simulations in layered media. I would be grateful if you could provide some guidance on the following issues to enable us start using the MCX code:

1) For the mcxlab 2020 version software package, after downloading and extracting, the main mcxlab function file and .mex file appear to be missing (needed to run the mcxlab). I just wanted to ask your advice on where we could obtain these files from. Also, would an earlier version of the mex file work for the 2020 mcxlab package and would the function file (found online) work for any version of mcxlab?

2) Can the MC code output the total pathlength travelled by each photon in each tissue type?

3) Can we output the x,y,z locations and tissue type at that particular location as each photon travels through the medium?

These are the queries I have and I'm eagerly looking forward to hearing from you!


Best,

Saurabh

Qianqian Fang

unread,
Feb 22, 2021, 8:25:46 AM2/22/21
to mcx-...@googlegroups.com, Saurabh Nair
On 2/22/21 6:28 AM, Saurabh Nair wrote:

Dear Dr. Fang,

I am working on a project involving MC simulations in layered media. I would be grateful if you could provide some guidance on the following issues to enable us start using the MCX code:

1) For the mcxlab 2020 version software package, after downloading and extracting, the main mcxlab function file and .mex file appear to be missing (needed to run the mcxlab). I just wanted to ask your advice on where we could obtain these files from. Also, would an earlier version of the mex file work for the 2020 mcxlab package and would the function file (found online) work for any version of mcxlab?


hi Saurabh,

it sounds like you've downloaded the mcx source code package? please download and extract the mcxlab package built for your platform, you should see mcx.mex* and mcxlab.m in the top folder.

mcx.mex is for GNU Octave, we have only been successful in compiling it for Linux so far, is that what you are looking for?


2) Can the MC code output the total pathlength travelled by each photon in each tissue type?



3) Can we output the x,y,z locations and tissue type at that particular location as each photon travels through the medium?


yes, trajectory data are returned as the 5th output of mcxlab

https://github.com/fangq/mcx/blob/master/mcxlab/mcxlab.m#L271-L278
https://github.com/fangq/mcx/blob/master/mcxlab/mcxlab.m#L317

let me know if you have further questions.


Qianqian

These are the queries I have and I'm eagerly looking forward to hearing from you!


Best,

Saurabh

--
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/46748b70-ceab-4d83-bed7-cec6a71f1701n%40googlegroups.com.

Saurabh Nair

unread,
Feb 23, 2021, 11:22:22 PM2/23/21
to mcx-users
Hello Dr. Fang,
Thank you very much for your prompt response. 
First, I read through the links that show where I can find the partial pathlength. But, it says that it computes and gives the cumulative pathlength of all mediums. If suppose I have 2 or 3 mediums, is it possible to find out the pathlength for each medium the photon travels through individually?
Second, regarding the trajectory, the 5th output of mcxlab gives the trajectory of each photon at only one location. It has the format - (id,x,y,z,weight,reserved). I have 2 questions pertaining to this. In this format, x,y,z represent which position of the photon? Also, can the code help me get the x,y,z locations at every position the photon travels inside the medium?(since it just shows me values for just one position now?)
Thank you very much once again and I am eagerly looking forward to hearing from you!

Best,
Saurabh

Qianqian Fang

unread,
Feb 24, 2021, 8:41:36 AM2/24/21
to mcx-...@googlegroups.com, Saurabh Nair
On 2/23/21 11:22 PM, Saurabh Nair wrote:
Hello Dr. Fang,
Thank you very much for your prompt response. 
First, I read through the links that show where I can find the partial pathlength. But, it says that it computes and gives the cumulative pathlength of all mediums. If suppose I have 2 or 3 mediums, is it possible to find out the pathlength for each medium the photon travels through individually?

I still don't fully understand what you are looking for - yes, the partial pathlength is accumulated pathlengths in each medium per photon. if you have 3 medium, each detected photon outputs 3 numbers, representing the total paths it travels in each medium.


Second, regarding the trajectory, the 5th output of mcxlab gives the trajectory of each photon at only one location. It has the format - (id,x,y,z,weight,reserved). I have 2 questions pertaining to this. In this format, x,y,z represent which position of the photon? Also, can the code help me get the x,y,z locations at every position the photon travels inside the medium?(since it just shows me values for just one position now?)


the x/y/z coordinates on those trajectories are in voxel units, so a simple rounding operation can convert them to the voxel i/j/k indices, and you can use that voxel index to look up the medium type, is this what you are looking for?


Reply all
Reply to author
Forward
0 new messages