Results Interpretation and Detectors Query

69 views
Skip to first unread message

kallepa...@gmail.com

unread,
Nov 10, 2019, 9:18:01 AM11/10/19
to Virtual Photonics

Dear Carole, 

I have been able to do everything I previously requested information for. 

With the results and a future experimental scenario, I had the following questions: 

- The attached file has been generated by deleting ONLY the "Z": {} section of the "DetectorInputs" and the rest of the infile left unaltered. 
- I am trying to interpret the depth as the complete model is about 15 mm thick 
Question 1: How do I infer this, beyond z=0, which is the surface of the model?
- I am also trying to figure out why there is the black section in the middle of the image. 
Question 2: Is this due to lack of photons in the area or do I need to remove additional lines from the infile? 
 
Question 3: How can I place detectors at various depths?  

I do apologise if these questions have been previously answered. If they have, please direct me to the relevant links. 
I am very grateful for your advice, 

Thank you, 
Best regards, 
Akhil  
Query.png

Carole Hayakawa

unread,
Nov 10, 2019, 11:05:59 AM11/10/19
to Virtual Photonics
Hi Akhil,

I have a couple of questions and comments:
1) When you say " deleting ONLY the "Z": {} section of the "DetectorInputs" ", how did you do this?  Our infiles are set up such that sections should not be deleted because each section is needed for the simulation to read the input correctly. Would it be possible to send your infile and describe the section you deleted?
2) The results presented are for the detector FluenceOfRhoAndZ.  Whatever you specify as your "Z" "Start" "Stop" and "Count" will dictate the span and grid of the detector results.  It looks as though you're using our GUI to generate the results.  The GUI is limited in what can be plotted.  I think we currently only support RORho and FluenceOfRhoAndZ results to be shown.  I would suggest you use our Monte Carlo command line (MCCL) application because many more detectors are available to you.  We have script files included in the download that use MATLAB to plot the results.
3) The black spot in the middle is because cylindrical coordinates are defined.  The "Rho" bins are cylindrical rings about the z-axis.  This is often used to increase the number of tallies in the detector bins if there is cylindrical symmetry in the tissue definition.  However, after the photons enter the tissue at z=0, they start to scatter off axis.  In addition the center most cylindrical bins are the smallest.  So this is why the black spot occurs.  If you ran more photons that black area would decrease.  We also have a Cartesian coordinates fluence detector, FluenceOfXAndYAndZ.
4) The FluenceOf..., AOf ...(absorbed energy) and RadianceOf... detectors are internal detectors capturing those estimates at the depths you specify in the detector "Z" definition.

I hope this helps.
Best,
Carole

kallepa...@gmail.com

unread,
Nov 10, 2019, 11:31:08 AM11/10/19
to Virtual Photonics
Dear Carole, 

I have attached the infile here with this message. :) 

  1. By deleting the Z{} detector input (immediately AFTER the tissue model is defined), I was hoping to only have detectors on the surface of the model (Rho) for reflectance. Is my interpretation correct? If not, could you please take a look at the infile and tell me what actually is happening when I only delete the Z parameters of the detector? 
  2. I was JUST about to write to you regd. the MCCL and MATLAB usage. However, I decided to give it a spin and it works like a charm. However, would you say the MCCL tool gives me the same image-results as the GUI? If so, I can drop the GUI usage and use the Command Line for all analysis. I had to play with the path settings but I seem to have got a hang of it now. Win-win :) 
  3. I had a look through the rest of the documentation as well, and you are quite right (of course!). I am just starting to place them. 
I am currently working on two research articles, both of which I have to complete soon; I am on a deadline AND require comparison of results with another MC Raytracing tool. My apologies if I am asking questions that have already been discussed. I find conversational clarification a touch easier. So, thank you so much! 

Best regards, 
Akhil 

Best regards, 
Akhil 
infile_eight_layers_all_detectors.txt

Carole Hayakawa

unread,
Nov 10, 2019, 11:49:54 AM11/10/19
to Virtual Photonics
Hi Akhil,

I see what you did now.  The "Z" definition that you deleted was for the AOfRhoAndZ detector (absorbed energy as a function of rho and z, internal cylindrical coordinates).  I'm actually surprised the infile ran with this deletion.    
1) To have a surface reflection result, you want to use ROfRho detector which is further down in the infile.  By the way I think you have started with the infile infile_one_layer_all_detectors.txt which provides an example of *all* of our detectors.  Your simulation will run much faster if you cut out the detectors that you don't need.  Just make sure you delete an entire detector and resulting curly braces make sense.  For example this is an entire detector:

    {
      "TallyType": "FluenceOfXAndYAndZ",
      "Name": "FluenceOfXAndYAndZ",
      "X": {
        "Start": -10.0,
        "Stop": 10.0,
        "Count": 201
      },
      "Y": {
        "Start": -10.0,
        "Stop": 10.0,
        "Count": 2
      },
      "Z": {
        "Start": 0.0,
        "Stop": 10.0,
        "Count": 101
      },
      "TallySecondMoment": false,
      "TallyDetails": {
        "IsReflectanceTally": false,
        "IsTransmittanceTally": false,
        "IsSpecularReflectanceTally": false,
        "IsInternalSurfaceTally": false,
        "IspMCReflectanceTally": false,
        "IsDosimetryTally": false,
        "IsVolumeTally": true,
        "IsCylindricalTally": false,
        "IsNotImplementedForDAW": false,
        "IsNotImplementedForCAW": true,
        "IsNotImplementedYet": false
      }
    },

Here is documentation about the most commonly used detectors we have:
https://github.com/VirtualPhotonics/VTS/wiki/MCCL-Capabilities-And-Implementation

2) The MCCL actually gives better image results than the GUI. And since it uses MATLAB to
visualize the results, you have other MATLAB commands at your disposal to enhance the plot,
e.g. axis labels, font sizes, etc.

Don't hesitate to post again if you get stuck.
Best,
Carole

kallepa...@gmail.com

unread,
Nov 10, 2019, 1:17:57 PM11/10/19
to Virtual Photonics
Hi Carole, 

Ah, I see what happened. AND thank you for the advice about the detectors. I have been tinkering with the tool for a while, I finally feel it is coming together now and I have an understanding of what does what. 

Will write to you instantly should anything come up -- Thank you so much for being so accommodating. 

Best regards, 
Akhil 

kallepa...@gmail.com

unread,
Nov 15, 2019, 9:57:52 AM11/15/19
to Virtual Photonics
Dear Carole, 

Quick, related question. 
Is it safe to assume that should any of the parameters like the continuity of layers and detector definitions be incorrect, the program won't run? I am testing all my infiles on the GUI with 100 photons before using MCCL with 1,000,000 photons. 

Best regards, 
Akhil 

On Sunday, 10 November 2019 16:49:54 UTC, Carole Hayakawa wrote:

Carole Hayakawa

unread,
Nov 15, 2019, 10:58:18 AM11/15/19
to Virtual Photonics
Hi Akhil,

We have some sanity checking performed on the infile.  We *do* check the continuity of the layers.  We also check if you define a detector with cylindrical coordinates that it makes sense for the tissue defined.  The code checks a lot but may not check everything.  If something is wrong the errors will show immediately.  As a general practice though, I always run 100 photons before I run a large number.  

By the way I determined why your infile with the missing "Z" definition for AOfRhoAndZ ran okay.   The default constructor for the "Z" value is used when it is not overwritten by the infile.

Best,
Carole

kallepa...@gmail.com

unread,
Nov 18, 2019, 6:14:36 AM11/18/19
to Virtual Photonics
Dear Carole, 

Excellent. Thank you :)
A few follow up questions: 

1. I have defined my RadianceOfRhoAtZ detectors as below (note the change of the "Name" variable. However, the TallyCount in the results file is showing me the same value at different Z depths. How do I read/analyse/interpret this data? 

2.  Is there a graphic to illustrate the distribution of the photons at a fixed depth and can this be done with RadianceOfRhoAtZ? 

3. Is my understanding correct that all the Transmission detectors are automatically set to the final Z value, where the model terminates and "Air" begins? 

Thank you, 
Best regards, 
Akhil
{
 
"Rho": {
   
"Start": 0.0,
   
"Stop": 10.0,
   
"Count": 201
 
},
 
"ZDepth": 6.0,
 
"TallyCount": 1806112,
 
"TallyType": "RadianceOfRhoAtZ",
 
"Name": "RadianceOfRhoAtZAt6",

 
"TallySecondMoment": false,
 
"TallyDetails": {
   
"IsReflectanceTally": false,
   
"IsTransmittanceTally": false,
   
"IsSpecularReflectanceTally": false,

   
"IsInternalSurfaceTally": true,
   
"IspMCReflectanceTally": false,
   
"IsDosimetryTally": false,
   
"IsVolumeTally": false,
   
"IsCylindricalTally": true,
   
"IsNotImplementedForDAW": false,
   
"IsNotImplementedForCAW": false,
   
"IsNotImplementedYet": false
 
}
}

Carole Hayakawa

unread,
Nov 18, 2019, 11:32:58 AM11/18/19
to Virtual Photonics
Hi Akhil,

RadianceOfRhoAtZ is a detector that captures the radiance in the *downward* direction through the plane at depth z.  So it will tally every time a photon passes through the plane in the downward direction.  This photon could scatter back up to the surface and tally again when it passes down through the plane again.  If you are seeing the same tally count for different z depths then you are probably specifying a depths where the light field is strong.  Try setting the z depth to something very large, far away from the source and you should see a difference in the tally count.

When you say "illustrate the distribution of the photons at a fixed depth", do you mean lateral distribution?  If so then yes, RadianceOfRhoAtZ would do this for you.  Keep in mind this detector is directional so only capturing downward flow. 

Yes, transmission detection is performed as the photons exit the final tissue layer and enter the air layer below.

Best,
Carole

kallepa...@gmail.com

unread,
Nov 18, 2019, 6:39:34 PM11/18/19
to Virtual Photonics
That is perfect. I am really getting a hang of MCCL and generating my results now. 
Probably one of the final questions (for this post, at least). 

How am I interpreting these results? Are they %s, Watts? What units are generally employed across the model? 

Absorbed energy captured by AOfRhoAndZ detector: 0.79695
Total absorption captured by ATotal detector: 0.79695
Fluence captured by FluenceOfRhoAndZAndTime detector: 2.5691
Fluence captured by FluenceOfRhoAndZ detector: 2.5691
Total reflectance captured by RDiffuse detector: 0.1817
Total reflectance captured by ROfRhoAndTime detector: 0.1817
Total reflectance captured by ROfRho detector: 0.1817
Total reflectance captured by RSpecular detector: 0.021297
Total transmittance captured by TDiffuse detector: 5.552e-05
Total transmittance captured by TOfRho detector: 5.552e-05

Thank you so much, Carole. The usage would not have been as effective without your help!

Best regards, 
Akhil

Carole Hayakawa

unread,
Nov 18, 2019, 7:48:53 PM11/18/19
to Virtual Photonics
Hi Akhil,

I general our units are:
space: mm
time: ns
temporal-frequency: GHz
spatial-frequency: 1/mm

Absorbed energy units in Monte Carlo terms is (photon weight)/(mm^3).  The Monte Carlo results have been normalized to a source of weight 1 (divided by N).  In general, if your source is in Watts, then you would multiply your results accordingly and the units would be W/(mm^3).

Fluence is (photon weight)/(mm^2).

Reflectance/transmittance are (photon weight)/(mm^2).

When the results of say ROfRho are output, they have been normalized by (divided by) the number of photons launched (N) and by the area of the detector.  In the case of ROfRho, the detectors are concentric rings defined by the Rho Start Stop and Count specifications in the infile.

In the output you show above, the division by the area of the detector is undone and the results are summed together to create a "Total reflectance" value.  And RDiffuse + ATotal + TDiffuse + RSpecular should sum to 1 because the source light =1 will end up in one of these categories.

I'm glad I've been helpful!
Best,
Carole

kallepa...@gmail.com

unread,
Dec 3, 2019, 5:52:00 PM12/3/19
to Virtual Photonics
Dear Carole, 

Thank you. I am clear with everything except the "photon weight" quantity. I am sorry I keep coming back to this because of a bit of confusion. 
I want to share an example so you can help me understand and present the results accurately. 

- Let's say I am sending 1,000,000 photons into the optical model. 
- I also want to assume that all the photons combined transfer an initial power of 4 mW into the tissue (can this assumption be made, firstly?). 
- What multiplications will I need to perform? Or I am confusing different concepts? 

The reason why I ask is if the data is normalised, then the final results are complete and need not be altered except for the 'mW' unit (my understanding). 

Best regards, 
Akhil 

Carole Hayakawa

unread,
Dec 3, 2019, 7:49:18 PM12/3/19
to Virtual Photonics
Hi Akhil,

If you put mW's in then your output will be in terms of mW's.  If you assume a 4 mW source, then for example, you would multiply the reflectance versus source-detector separation rho or R(rho) results by 4 to obtain reflectance results in terms of (mW/mm^2).

kallepa...@gmail.com

unread,
Dec 3, 2019, 7:56:19 PM12/3/19
to Virtual Photonics
Ah, yes! I guessed as much but it seemed "too straight-forward to be true" 
*wink*

Does the simple multiplication apply to everything? Fluence, AOfRhoAndZ, log(ROfRho), log(TOfRho) outputs too? 

Thank you so much, Carole. That does help a lot. It was literally the last step I needed to convert my final results into publishable results. 

Best regards, 
Akhil 

Carole Hayakawa

unread,
Dec 3, 2019, 9:57:12 PM12/3/19
to Virtual Photonics
Hi Akhil,

Yes, simple multiplication should apply to everything.  For the log outputs, just apply factor prior to taking log.

Best,
Carole

kallepa...@gmail.com

unread,
Dec 4, 2019, 7:33:54 AM12/4/19
to Virtual Photonics
Thank you so much, Carole. I did realise that I would have to multiply the "photonWeight" in other places as well. Does the following code for ROfRho in MATLAB look right? Specifically, could you check the placement of the "photonWeight" variable?

    if isfield(results{di}, 'ROfRho') && show.ROfRho
        figname = sprintf('log(%s)',results{di}.ROfRho.Name); figure; plot(results{di}.ROfRho.Rho_Midpoints, log10(photonWeight*results{di}.ROfRho.Mean)); title(figname); set(gcf,'Name', figname); xlabel('$\rho$ [mm]','Interpreter','latex'); ylabel('R($\rho$) [mm$^{-2}$]','Interpreter','latex');
        rhodelta = photonWeight*(results{di}.ROfRho.Rho(2)-results{di}.ROfRho.Rho(1));
        rhonorm = 2 * pi * results{di}.ROfRho.Rho_Midpoints * rhodelta;
        disp(['Total reflectance captured by ROfRho detector: ' num2str(sum(photonWeight*results{di}.ROfRho.Mean.*rhonorm'))]);
    end

As a suggestion for future results generation, maybe you could add the following lines at the top of the Results script for auto multiplication and have the variable photonWeight in all the appropriate places? Just a suggestion :-) This may not be universally applicable, though. 

datanames = { 'infile_name' };
photonWeight = 4.5; % Input Power 

With your confirmation, I will set and ready to start saving my images. 

Best regards, 
Akhil 

Carole Hayakawa

unread,
Dec 4, 2019, 11:14:23 AM12/4/19
to Virtual Photonics
Hi Akhil,

In the example code you provide, you would only need to multiply the photonWeight (which in your definition equals Input Power) by results{di}.ROfRho.Mean.  Therefore, all edits you made are good except REMOVE this factor from:
  rhodelta = photonWeight*(results{di}.ROfRho.Rho(2)-results{di}.ROfRho.Rho(1));
rhodelta is a variable that determines the size of the rho bins and is not involved in the Input Power.

Also, in our MCCL Getting Started page on GItHub we describe that the user needs to modify "datanames":

You are actually the first person to ask about applying an input power factor.  Something to consider.

Best,
Carole


kallepa...@gmail.com

unread,
Dec 4, 2019, 1:55:35 PM12/4/19
to Virtual Photonics
Dear Carole, 

Perfect :-) 
Thank you so much. 

And glad I could share something that could be an interesting modality in the package in the future. 

Best regards, 
Akhil 
Reply all
Reply to author
Forward
0 new messages