VirtualPhotonics / VTS

Virtual Tissue Simulator
https://virtualphotonics.org
Other
34 stars 9 forks source link

Ch 230221 more mods for fluorescence #66

Closed hayakawa16 closed 1 year ago

hayakawa16 commented 1 year ago

Hi, I'm ready for the review of this branch. I added Janaka.
Janaka, there is an easy way to review changes by using "Files changed" tab above which shows changes from Master. Let me know if you have questions. Thanks for your help!

janakarana commented 1 year ago

"There are two methods used to sample the absorbed energy: CDF or Uniform.  Using the CDF method, a probability density function (PDF) and resulting cumulative  function (CDF) is determined from the absorbed energy map.  Then the number of photons  launched from each fluorescent voxel is determined probabilistically from sampling the CDF.      And the weight of each photon is set to the total absorbed energy of the fluorescing region because if N photons are launched the results are normalized by N producing back the total absorbed energy. Using the Uniform method, the same number of photons is sent out from each voxel with weight equal to the absorbed energy of that voxel.  HOWEVER, the results of a multiple voxel source CANNOT be combined because the initial weight is different  So if the fluorescing region has more than 1 voxel, each voxel must be simulated with a different simulation (possibly using the parallel MC)."

I fully agree on this approach. I think you have to normalize the results by the volume of the source voxel. Because if you consider a non-cuboidal shape, only part of the  boundary voxels contribute.  If you include the volume of the voxel during absorbed energy calculation, it can be ignored.

hayakawa16 commented 1 year ago

Thank you very much for your review Janaka! If I understand your last comment correctly, then yes the absorbed energy results read in by the fluorescent source have already been normalized by the volume in which the tally was performed. So for AOfXAndYAndZ the results were written to the file normalized by the voxel volume and for AOfRhoAndZ the results were written to file normalized by the respective cylindrical volume.

One of the things I learned the hard way, is that our absorbed energy tallies tally photon contributions beyond the grid specified by the detector into the last bin. We did this so that multiplying back by the bin size and summing would produce total absorbed energy. These "edge" bins cannot be included in the absorbed excitation because of this. So specifying the appropriate domain for the absorbed energy tallies (adding a extra bin on the edges) needs to be done because in the fluorescent source code, I omit these edge voxels.

hayakawa16 commented 1 year ago

Lisa reviewed the validation code and saw the use of the "dynamic" cast can be replaced with actual class cast and should. I plan to do this and have a re-review from Lisa.

hayakawa16 commented 1 year ago

In the validation classes, I replaced the "dynamic" case to actual class when possible. In addition, I made all validation classes "static". Ready for re-review.