Normalization in Optical Simulation

289 views
Skip to first unread message

Kathy Young

unread,
Aug 23, 2023, 10:37:52 AM8/23/23
to mcx-users
Dear Dr. Fang

I hope find you well. I have a question regarding the normalization process in optical simulations. I would greatly appreciate it if you could provide some insights or explanations on the following points:

1. How is normalization performed in optical simulations in “mcxlab”? Could you please explain the process to achieve it?

2. In the case where data has already been normalized, so how to do the procedure for reverse normalization? How can one transform the normalized data back to its original scale?

3. In “mcxlab”  , “cfg.isnormalized =1” was been used, not the fluence are not ranged in [0 1]. Please you please clarify what’s the scales of the normalization. What’s the unit in the simulation? Is W/mm^2?

Thank you very much for your time and assistance. I look forward to your valuable input and the opportunity to learn from your expertise.

Best regards,
Kathy

Qianqian Fang

unread,
Aug 23, 2023, 11:16:27 AM8/23/23
to mcx-...@googlegroups.com, Kathy Young
hi Kathy, see my replies below


On 8/23/23 05:36, Kathy Young wrote:
Dear Dr. Fang

I hope find you well. I have a question regarding the normalization process in optical simulations. I would greatly appreciate it if you could provide some insights or explanations on the following points:

1. How is normalization performed in optical simulations in “mcxlab”? Could you please explain the process to achieve it?


mcx/mcxlab/pmcx handles normalization the same way - by default, the cfg.isnormalized flag is set to 1, so a normalization is performed, unless you setting it to 0 explicitly.

the goal of the "normalization" step is to cancel out the effect of number of simulated photons, voxel sizes and source type differences, so that on the same "physical domain", regardless of your simulation settings, you can get a repeatable, verifiable solution.

you can probably see there are many ways to do this, but our target is set to match the solution against the "Green's function" of the underlying PDE (RTE or diffusion). The Green's function is a unique solution produced by setting the source term (right-hand-side) of the PDE to a Diract-delta-function, which when you integrate the entire source, it should have a total integration value (or energy) of 1, i.e. a unitary source. please read more about Green's function if you are not familar with it.

https://en.wikipedia.org/wiki/Green%27s_function


a simple example, when we solve the diffusion equation in an infinite homogeneous domain, you can write the Green's function as


Phi(r)=exp(-sqrt(3*mua*musp)*r)/(4*pi*D*r )

where D=1/(3*(mua+musp)) is the diffusion coefficient. This is derived by setting the source term of the Diffusion equation to a delta(r) function.


this is the solution mcx/mcxlab is trying to match, voxel-by-voxel. After normalization. No matter how many photons you simulation, what voxel size you choose, mcx's fluence output (cfg.outputtype='fluence') will always match this analytical solution, if it does exists, when solved in the same physical domain. Of course, in complex domains, such analytical solution does not exist, but mcx/mcxlab still perform the same normalization formula, so that you can assume the fluence it computes should match the distribution produced by a unitary source in that complex domain.


the Green's function mcx's normalization formula trying to match is not limited to static Green's function, but can have a time-dependency. So, in general, we say mcx produces the TPSF - time point spread function, which is just another name of a 4D (x/y/z/t) Green's function. here is our analytical formula of a semin-infinite domain for CW (static) and time-varying (time-domain) Green's function, and we match these in our publications


https://github.com/fangq/mcx/blob/master/utils/tddiffusion.m

https://github.com/fangq/mcx/blob/master/utils/cwdiffusion.m



2. In the case where data has already been normalized, so how to do the procedure for reverse normalization? How can one transform the normalized data back to its original scale?


the first output of mcxlab, flux, contains a subfield called stat, which stores the normalization factor as flux.stat.normalizer. You can simply divide this factor to undo the normalization if it has been done, or simply setting cfg,isnormalized to 0 and rerun the simulation.

https://github.com/fangq/mcx/blob/011943121de9114832ca3b99867f3d12963be9d0/src/mcxlab.cpp#L104



3. In “mcxlab”  , “cfg.isnormalized =1” was been used, not the fluence are not ranged in [0 1]. Please you please clarify what’s the scales of the normalization. What’s the unit in the simulation? Is W/mm^2?


as I mentioned, mcx's normalization is not aimed to make the max/min value to 1 (which is quite problematic) - instead, it normalizes the total source energy to 1 to generate analytically understandable Green's function.


the exact formula to compute mcx's normalization factor is dependent on the output type, you can see the full source code here

https://github.com/fangq/mcx/blob/011943121de9114832ca3b99867f3d12963be9d0/src/mcx_core.cu#L3492-L3590


let me know if these make sense.


Qianqian



Thank you very much for your time and assistance. I look forward to your valuable input and the opportunity to learn from your expertise.

Best regards,
Kathy
--
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/a6b3a6c9-5cc0-4c43-8fb6-b5377b1b86fan%40googlegroups.com.


Kathy Young

unread,
Aug 23, 2023, 10:39:15 PM8/23/23
to mcx-users

Dear Dr. Fang,

 

Thank you for your prompt response. I have some further inquiries regarding the simulation capabilities of "mcxlab" on the following topics:

 

1. Multi-angle Source Simulation:

 

   - How can I simulate multiple angles of light sources in "mcxlab"? Do I need to simulate each angle separately and then combine the results?

   - How should I handle the normalization process when simulating multiple angles of light sources? Are there specific functions or settings in "mcxlab" for this?

 

2. Different Intensity Simulation:

 

   - What is the recommended approach for simulating different light intensities in "mcxlab"? Are there direct simulation functions or parameter settings available?

 

I would appreciate any insights or guidance on these topics, especially regarding implementation details or specific functions/commands within the "mcxlab" framework.

 

Thank you for your time and assistance. I look forward to your valuable insights.

 

Best regards,

Kathy Young

Qianqian Fang

unread,
Aug 25, 2023, 4:29:14 PM8/25/23
to mcx-...@googlegroups.com, Kathy Young
hi Kathy, see my replies below

On 8/23/23 22:39, Kathy Young wrote:

Dear Dr. Fang,

 

Thank you for your prompt response. I have some further inquiries regarding the simulation capabilities of "mcxlab" on the following topics:

 

1. Multi-angle Source Simulation:

 

   - How can I simulate multiple angles of light sources in "mcxlab"? Do I need to simulate each angle separately and then combine the results?


yes, this is the recommended way, given the current code.


   - How should I handle the normalization process when simulating multiple angles of light sources? Are there specific functions or settings in "mcxlab" for this?


mcx volumetric solution (fluence/flux/energy) is linearly proportional to the source intensity, you can use mcx to simulate multiple angular components with normalization on - and then multiply different angles with their corresponding relative intensity and sum the solutions together. this is equivalent to simulating angularly modulated source, which mcx currently does not support (planned, but not implemented: https://github.com/fangq/mcx/issues/129)

there is no particular mcxlab function do this. you just call mcxlab for each angular component, and do the weighted sum outside of mcxlab.


 

2. Different Intensity Simulation:

 

   - What is the recommended approach for simulating different light intensities in "mcxlab"? Are there direct simulation functions or parameter settings available?

 


again, mcx solution is linear to the source intensity - once you simulate a source of unitary intensity by default, you can multiply it by a scalar to simulate any other intensity levels.


the above linear summation of multiple simulation approach works fine for multiple discrete sources, it, however, will be tedious and less efficient if you have many components.


Qianqian



Kathy Young

unread,
Aug 29, 2023, 6:19:25 AM8/29/23
to mcx-users
Dear Dr. Fang.

Thanks very much for your comments and explanation. Those answers are very useful for my present work. I will follow your suggestion to build the simulation. 

Thanks a lot.

Best,
Xi

Kathy Young

unread,
Sep 1, 2023, 4:47:23 AM9/1/23
to mcx-users
Dear Dr. Fang,

Last time, you have mentioned that "mcx solution is linear to the source intensity." 

Following our discussion, I conducted thorough research to find supporting references for this statement but unfortunately did not yield any results.

Could you please provide some references for your summary of that. I will be very appreciated.

Best,
Xi

Qianqian Fang

unread,
Sep 1, 2023, 12:40:57 PM9/1/23
to mcx-...@googlegroups.com, Kathy Young
you are unlikely to see explicit statement like this in optics literature, because it is a much more general statement that applies to a wide range of differential/integral equations across most physics domains, not just optics. the courses that you may see this is likely in college- or graduate level calculus, mathematical methods or PDE/ODE courses.

essentially, differentiation and integration are linear operators, so most of the PDEs/integral equations that govern the bulk of our known physics laws, or differntial-integral equations (such as radiative transfer equation/RTE that MC solves for) are all linear operators that follows two basic properties

L(a+b)=L(a)+L(b), and
L(c*f) = c*L(f)

where a/b/f are arbitrary functions, c is a constant.


that's also why many of these physical models can be discretized as a matrix/linear equation and solve numerically (such as in finite element, finite difference, method of moment etc). "Coupled ODEs" and PDEs are tricky and may produces nonlinearity.


if you really want to read about this, you can search the relevant keywords and find some online lectures on math methods/pde or functional analyses


Qianqian

Kathy Young

unread,
Sep 10, 2023, 5:56:09 AM9/10/23
to mcx-users
Dear Dr. Fang,

Thanks very much for your patience with my questions. Your suggestions are very helpful for me to understand this mathematical mechanism. I will search for materials following your comments. Thanks a lot.


Best,
Kathy

Reply all
Reply to author
Forward
0 new messages