Made a small function for capturing diffuse reflectance

388 views
Skip to first unread message

ALEXANDER P. Dumont

unread,
Jun 11, 2016, 10:30:43 PM6/11/16
to mcx-users
Hi everyone

I've been having problems figuring out how to get diffuse reflectance with MCX Extreme. After a bit of searching on this forum, I finally figure it out, and I would like to share the file I used with all of you guys. 
GetReflectance.m

Qianqian Fang

unread,
Jun 13, 2016, 7:26:56 PM6/13/16
to mcx-...@googlegroups.com
On 06/11/2016 10:30 PM, ALEXANDER P. Dumont wrote:
Hi everyone

I've been having problems figuring out how to get diffuse reflectance with MCX Extreme. After a bit of searching on this forum, I finally figure it out, and I would like to share the file I used with all of you guys. 


hi Alex

I haven't look into this in details, but one question for you, what's
your preferred license form for this function? in other words, do
you allow other users to modify/include in other software? what
are the restrictions?

For free-licenses, here are some comparisons between the popular ones
http://choosealicense.com/licenses/


Qianqian

ALEXANDER P. Dumont

unread,
Jun 13, 2016, 9:37:10 PM6/13/16
to mcx-users
Hi Dr. Fang

I think the MIT license is fine. People can of course modify my software and include in their software. There are no restrictions. Neat I did not know there were all those open source liceses.

Peter McLachlan

unread,
Jul 8, 2016, 12:10:53 PM7/8/16
to mcx-users
Hello,

Thank you for sharing this. I'm very interested in measuring reflectance (light fluence exiting the simulation volume) for given detector positions in MCX. Just wondering if this function helps to measure the reflectance at the surface of the boundary of the simulation volume? 

As far as I understand, and hopefully I am wrong, in MCX, detectors are actually infinitesimal spheres in the centre of a voxel and so don't truly measure the reflectance of photons leaving the volume. Doing this would require some knowledge of the direction of the photons being detected or an actual detector on the surface. Do you agree? Thank you for your help.

Peter

ALEXANDER P. Dumont

unread,
Jul 10, 2016, 12:39:21 PM7/10/16
to mcx-users
You can actually place a detector at the surface and specify its radius, and\position in x y and z. So if your media is a 20 x 20 x 20 unit block your source is cfg.srcpos = [10 10 0] going upwards you can absolutely say cfg.detpos = [10 10 0 10] and that places a detector at the position [10 10 0] that has radius equal to 10, so it captures most of the light exiting in the direction the light is input. I then applied Beer's law to get the intensity vs path length through heterodyne media of all the captured photons by the detector. You can have multiple detectors so my function takes that into consideration. 

Peter McLachlan

unread,
Jul 13, 2016, 11:06:41 AM7/13/16
to mcx-users
Thanks. My question is, with multiple detectors can you then get R(r)? the reflected light intensity as a function of (source-detector) position? 

ALEXANDER P. Dumont

unread,
Jul 15, 2016, 9:10:16 AM7/15/16
to mcx-users
You can but you have to be careful with overlapping detectors it will chose one or the other and you may lose some information. 

Wendy Yu

unread,
Apr 10, 2017, 2:19:58 AM4/10/17
to mcx-users
Dear all,

I have been also made an small executable to read and calculate reflectance from .mch and .inp files.
It can be around 20 times more faster than cpu-based calculation.
However, there may still have some bugs are not fully fixed.
I just want to share this source code as an inspiration for other mcx users. 
Hoping this program will be helpful to you.




After compile the source file, it can be simply run by the below command:

$ ./<executable_name> -f <filename_of_inp_and_mch>

There are more options can be set. You can see the details from source code or by this command:
$ ./<executable_name> -h



Wendy

Reply all
Reply to author
Forward
0 new messages