Angle-resolved Diffuse Reflectance

53 views
Skip to first unread message

Will Goth

unread,
Nov 23, 2020, 9:12:21 PM11/23/20
to Virtual Photonics
Hello, 
I am interested in using the MCCL program to provide angle-resolved diffuse reflectance at the surface of a medium. As there is not an existing detector that does this, I have two different ideas for achieving this. 

The first method is to use a radiance detector (with X, Y, Z, theta, and phi resolved detection). However, the radiance detector only appears to count photons which undergo some scattering or absorption event within the hypervoxel. Can you confirm that this is how the radiance detection is conducted? Alternatively, is there a way to modify either the radiance or diffuse reflectance detector to angularly resolve the light leaving the surface of the sample?

A second method is based on enumeration of the photons. In this case, a diffuse reflectance detector can be placed first at the surface, and second at some arbitrary location above the first. If the photons can be enumerated, those which travel through both the surface detector and the second detector can be preferentially selected, while ignoring the rest. In this way, the spatial image of photons exiting the sample surface that also meet the second detector region can be reconstructed. However, I'm unsure if 1.) this type of enumerated photon data is stored within the PostProcessor/pMC database files, and 2.) what the format of these files is (to parse out that information). 

I would greatly appreciate any insight from the VTS/MCCL managers on whether either of these methods would be preferable or if there are any better alternatives. 

Thank you,
-Will

Carole Hayakawa

unread,
Nov 23, 2020, 10:02:47 PM11/23/20
to Virtual Photonics
Hi Will,

Thanks for your interest in MCCL.  There are two angle-resolved reflectance detectors, ROfAngle and ROfRhoAndAngle.  Examples on how to specify them are in the infile_one_layer_all_detectors.txt that gets generated if you run the "geninfiles" option.  The positive z direction is into the tissue, so theta runs from pi/2 to pi (this would span the hemisphere in the air).

If you want not sure what angles to specify and want to try a variety, you could, as you mention, generate a "DiffuseReflectance" database by specifying this in the infile options.  Then post-process this file using various angle specifications.  A description of this process is given here:

Let me know if you need more details or get stuck.
Best,
Carole

Will Goth

unread,
Nov 24, 2020, 9:27:18 AM11/24/20
to virtual-...@googlegroups.com
Hi Carole,
Thanks so much for the quick reply. I may have mis-stated our intent in achieving angle-resolved detection. Our ideal detector would have information regarding the polar and azimuthal exit angles of light at the surface for each X and Y location on the surface. Currently, the ROfXAndY detector provides all of the light exiting the surface at each X and Y location, but does not resolve the angular output of photons at each of these locations. My impression was that the ROfAngle and ROfRhoAndAngledetector are rotationally symmetric around the origin, and therefore would not give any X and Y information. Or have I misunderstood those?

I've run the MCCL post processing, but what I'd like to know more about is what is stored in the database files. Does the database file enumerate each individual photon that is counted by a detector? And is this enumeration information directly accessible from parsing the database file? 
-Will
___________________________________


--
You received this message because you are subscribed to a topic in the Google Groups "Virtual Photonics" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtual-photonics/88PKACejDmI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtual-photon...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/virtual-photonics/aed9cecf-0436-4e51-b5fa-cede32e248ecn%40googlegroups.com.

Carole Hayakawa

unread,
Nov 24, 2020, 5:42:30 PM11/24/20
to Virtual Photonics
Dear Will,

Thanks for the clarification.  You are correct about the ROfAngle and ROfRhoAndAngle detector.  I could generate an ROfXAndYAndThetaAndPhi detector for you.  Let me know.

The DiffuseReflectanceDatabase stores for every photon that exited the surface of the tissue:
a) exit location
b) exit direction (in air)
c) exiting weight
d) total time in tissue
This individual data is accessible if you run the source code and either set a break point or add Console.WriteLine statements to output the details.

Best,
Carole

Will Goth

unread,
Nov 24, 2020, 10:58:17 PM11/24/20
to virtual-...@googlegroups.com
Hi Carole,

A R(x,y,theta,phi) detector would certainly be extremely useful to us! Is that a large undertaking or is it relatively straight forward?

That's great to hear about the content of the database files and will also be very useful.  My plan is to extract information based on the VTS/src/Vts/MonteCarlo/IO/DataraseReader.cs code. As an alternative, is there a description of the database structure anywhere that I can work with to read in the data using other programs such as python or matlab? I'm assuming it's just a binary format.

Thank you again for the help,
-Will



Carole Hayakawa

unread,
Nov 25, 2020, 2:32:17 PM11/25/20
to Virtual Photonics
Hi Will,

I will work on the R(x,y,theta,phi) detector, it is straightforward.

I don't think you can read the database binary directly into MATLAB, but not entirely sure about this (first time anyone has asked!).  I know our detector binaries require the "jsonlab" folder code in order to be read into MATLAB.  Their associate *.txt files provide the dimensions within the binary.  I guess if you knew the dimensions of the database binary it might be possible.  The database *.txt file lists how many photons are within it so there's that dimension.  I'll have to get back to you on this one.  Good question!

I'll keep you posted about the new detector.  It sounds like you have cloned a copy of our source code, so when I push to GitHub, I will let you know.

Best,
Carole

Will Goth

unread,
Nov 25, 2020, 2:37:16 PM11/25/20
to virtual-...@googlegroups.com
Hi Carole,
Thanks so much for the insight and help! I will take a shot at extracting the database info in the meantime and let you know if I run into anything strange. 
Best
-Will


Carole Hayakawa

unread,
Dec 2, 2020, 6:24:45 PM12/2/20
to Virtual Photonics
Hi Will,
I created a new ROfXAndYAndThetaAndPhi detector and pushed it to GitHub.  It sounds like you are working with the source code.  If so and you'd like to create a new MCCL executable, please refer to this page:
for linux (there are also pages for Windows and Mac).
Let me know how it goes.
Best,
Carole

Will Goth

unread,
Dec 3, 2020, 7:20:32 PM12/3/20
to virtual-...@googlegroups.com
Hi Carole,

Thank you so much! I will compile and run it this weekend when I get a chance. I greatly appreciate your help!

We were also able to successfully access the reflectance database content. I am cleaning up a python script that essentially allows access to the database information without need to run through the MC post processor, which is convenient in some circumstances.  I will share here when completed.

Best,
-Will
___________________________________

Carole Hayakawa

unread,
Dec 4, 2020, 10:21:19 AM12/4/20
to Virtual Photonics
Hi Will,
That is fantastic news about getting the database binary to load directly into MATLAB!  Thanks for sharing.
Best,
Carole

Will Goth

unread,
Dec 9, 2020, 8:30:17 PM12/9/20
to virtual-...@googlegroups.com
Hi Carole,
Please see the attached python-based binary database file reader. 

Also, when producing this data extraction code, my collaborator Romain noted that there was a flag for the photon state whose value could range from 0-0x110000. However, in the photon serializer code (PhotonDataPointSerlializer.cs), the value for this state flag is set to a single byte, meaning certain photon states cannot be saved. He wasn't sure if this was intentional to limit the file size from blowing up too large, but he thought it would be good to point out in case it was unintended.

I am hoping to have some time in the coming weeks to recompile the code and try some things with the angle-resolved detector, and will let you know how it goes!
Best,
-Will


___________________________________

DiffuseReflectanceDatabase.py

Carole Hayakawa

unread,
Dec 10, 2020, 2:55:14 PM12/10/20
to Virtual Photonics
Hi Will,

Thanks for sharing!  I look forward to giving it a try.  Part of our repository is for linux only and possibly we can add it there.

Within PhotonDataPoint (which gets written to the database) there is an enum PhotonStateType which is a bit map of the state of the photon upon termination.  It is used during the processing of the photon however once the next photon is launched it is forgotten.  Is not used by any readers of the database to date.  Interesting that you unearthed the fact that the state is not saved for certain states.  This was not intentional but currently has no impact.

Thanks for your feedback about our software and for your contribution!

Best,
Carole
Reply all
Reply to author
Forward
0 new messages