MCXLAB for acousto-optics simulation

160 views
Skip to first unread message

Deepak Sonker

unread,
Sep 30, 2021, 9:21:57 AM9/30/21
to mcx-users
Hi Dr. Fang,

My name is Deepak Sonker, I am pursuing masters in Biomedical Engineering.
I am currently working on acousto-optics simulation and would like to know that is there a way to simulate the acousto-optics using MCXLAB. I have simulated the focused ultrasound part on k-Wave and have the pressure matrix. 
I want to implement the optics simulation as discussed in Sakadžić, Sava, and Lihong V. Wang. "Correlation transfer equation for ultrasound-modulated multiply scattered light." Physical Review E 74.3 (2006): 036618. 
So I don't have any experience in GPU coding and I think I have to include some equations to calculate the modulation of light. How could I do this using MCXLAB.

Also, I found out that there is AO-MCX: Acousto-Optic Monte Carlo eXtreme (0.7.9) version by  Matt Adams but I couldn't find it. Here he modeled the AO technique. Is this file still there?

-BR
Deepak Sonker


Qianqian Fang

unread,
Sep 30, 2021, 10:23:57 AM9/30/21
to mcx-...@googlegroups.com, Deepak Sonker

hi Deepak,

the best way to obtain these derived codes is to directly contact the author/corresponding author of the paper. because mcx is open-source, most mcx-derived codes were modified/maintained separately by their respective authors and, in most cases, were not backported to the upstream mcx code base.

Qianqian



-BR
Deepak Sonker


--
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/60bfd31b-8128-42b0-af49-9abd01a64aabn%40googlegroups.com.

Deepak Sonker

unread,
Oct 13, 2021, 11:35:00 AM10/13/21
to mcx-users
Hi Dr. Fang,

Is there a way in MCXLAB to include the equations of Acousto-optics during the simulations?

I mean each voxel in MCX will contain the ultrasound (US) pressure values [Px,Py,Pz] with their phase information and each time a photon propagates inside the voxel I have to accumulate the phase change of photon due to US. This I have to do with each photon and at last I will get the autocorrelation function after summing the accumulated phase in every voxel. 

How should I do this in MCXLAB?


-BR
Deepak Sonker

Qianqian Fang

unread,
Oct 13, 2021, 12:19:55 PM10/13/21
to mcx-...@googlegroups.com, Deepak Sonker
On 10/13/21 11:35 AM, Deepak Sonker wrote:
Hi Dr. Fang,

Is there a way in MCXLAB to include the equations of Acousto-optics during the simulations?


not simultaneously. can you do it sequentially? I've seen works using K-wave to simulate US and use the output to run mcx.


I mean each voxel in MCX will contain the ultrasound (US) pressure values [Px,Py,Pz] with their phase information and each time a photon propagates inside the voxel I have to accumulate the phase change of photon due to US. This I have to do with each photon and at last I will get the autocorrelation function after summing the accumulated phase in every voxel. 

How should I do this in MCXLAB?


so a photon has to keep track of a phase state and update it in every voxel?

unfortunately it does not sound like something that is readily usable, you may likely need to modify mcx's source code to add this new variable.




-BR
Deepak Sonker

On Thursday, September 30, 2021 at 5:23:57 PM UTC+3 q.fang wrote:
On 9/29/21 6:43 PM, Deepak Sonker wrote:
Hi Dr. Fang,

My name is Deepak Sonker, I am pursuing masters in Biomedical Engineering.
I am currently working on acousto-optics simulation and would like to know that is there a way to simulate the acousto-optics using MCXLAB. I have simulated the focused ultrasound part on k-Wave and have the pressure matrix. 
I want to implement the optics simulation as discussed in Sakadžić, Sava, and Lihong V. Wang. "Correlation transfer equation for ultrasound-modulated multiply scattered light." Physical Review E 74.3 (2006): 036618. 
So I don't have any experience in GPU coding and I think I have to include some equations to calculate the modulation of light. How could I do this using MCXLAB.

Also, I found out that there is AO-MCX: Acousto-Optic Monte Carlo eXtreme (0.7.9) version by  Matt Adams but I couldn't find it. Here he modeled the AO technique. Is this file still there?


hi Deepak,

the best way to obtain these derived codes is to directly contact the author/corresponding author of the paper. because mcx is open-source, most mcx-derived codes were modified/maintained separately by their respective authors and, in most cases, were not backported to the upstream mcx code base.

Qianqian



-BR
Deepak Sonker


--
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/60bfd31b-8128-42b0-af49-9abd01a64aabn%40googlegroups.com.
--
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.

Deepak Sonker

unread,
Mar 6, 2022, 7:27:15 PM3/6/22
to mcx-users
Hi Dr. Fang,

I studied more on the previous modified MCX-AO code of 2013 and tried to change the existing MCX 2021 source code. I have made these changes and if you have time then please take a look. My aim is to retrieve two things on MCXLAB: first, each detected photon will have magnitude and phase due to Acousto-optics, 
second, like the fluence distribution I want modulated and unmodulated field distribution inside the medium. For this, I have field0 and field1 variables that will provide the unmodulated and modulated field respectively.
To accomplish the first and second task I will provide the ultraosund pressure field binary file and acoustic and optical constants. 

In the source code wherever I have made a change I wrote  "// MTA-DPK"

I have changed the source code to add the variables for ultrasound pressure and phase in each voxel and acoustic constants and variables for storing the modulated and unmodulated fields in utils.h and mcx_core.h files, respectively.           
                                                                    
utils.h changed link I have highlighted the whole thing 

a) In the main source code file i.e. mcx_core.cu file I have inserted the variables in device and constant memory and changed four functions:


ii) https://github.com/dpksonker/MCX-AO-Monte-Carlo-Xtreme---Acousto-optics-/blob/4f00664fe5750c76c7dfab98c038029c67a3804d/src/mcx_core.cu#L356-L369       here I modified the savedetphoton function to save the magnitude and phase of modulations suffered by each detected photon.





b) In the mcx_utils.c I have modified a few lines









Please provide me the steps to compile the mcx source code on linux. I have WSL-2 installed in Windows 11. Also, what I have to do to compile and develop mex version of my code?




-Br
Deepak

Qianqian Fang

unread,
Mar 6, 2022, 11:47:12 PM3/6/22
to mcx-...@googlegroups.com, Deepak Sonker
On 3/6/22 19:27, Deepak Sonker wrote:
Hi Dr. Fang,

I studied more on the previous modified MCX-AO code of 2013 and tried to change the existing MCX 2021 source code. I have made these changes and if you have time then please take a look. My aim is to retrieve two things on MCXLAB: first, each detected photon will have magnitude and phase due to Acousto-optics, 
second, like the fluence distribution I want modulated and unmodulated field distribution inside the medium. For this, I have field0 and field1 variables that will provide the unmodulated and modulated field respectively.
To accomplish the first and second task I will provide the ultraosund pressure field binary file and acoustic and optical constants. 

In the source code wherever I have made a change I wrote  "// MTA-DPK"

I have changed the source code to add the variables for ultrasound pressure and phase in each voxel and acoustic constants and variables for storing the modulated and unmodulated fields in utils.h and mcx_core.h files, respectively.           
...

Please provide me the steps to compile the mcx source code on linux. I have WSL-2 installed in Windows 11. Also, what I have to do to compile and develop mex version of my code?


compiling mcx executable is straightforward on Linux, you just need to install cuda toolkit (use apt-get), gcc, and you should be able to build it by "cd mcx/src && make"

you can also use cmake, see our CI setup

https://github.com/fangq/mcx/blob/master/.travis.yml


to build mcxlab, you need to install matlab with matlab compiler module. if it is set up correctly, you should be able to type 'mex -h' in a command line and see help info.

once this is set up, you just type "cd mcx/src && make mex"

if any error pops up, you need to fix it by either installing anything missing or update your code.



Qianqian

Reply all
Reply to author
Forward
0 new messages